srijs/rust-copperline

Compilation issues

Opened this issue · 2 comments

I added copper line as a dependency in my Cargo.toml:

[dependencies]
copperline = "0.3.0"

But when I try to compile the example code:

extern crate copperline;

use copperline::Copperline;

fn main() {

    let cfg = copperline::Config {
        encoding: copperline::Encoding::Utf8,
        mode: copperline::EditMode::Vi
    };

    let mut cl = Copperline::new();
    while let Ok(line) = cl.read_line(">> ", &cfg) {
        println!("Line: {}", line);
        cl.add_history(line);
    }
}

I get these errors:

cargo build
   Compiling remnant v0.1.0 (file:///Users/jay/repos/remnant)
src/main.rs:55:15: 55:33 error: `copperline::Config` does not name a structure [E0422]
src/main.rs:55     let cfg = copperline::Config {
                             ^~~~~~~~~~~~~~~~~~
src/main.rs:55:15: 55:33 help: run `rustc --explain E0422` to see a detailed explanation
src/main.rs:57:15: 57:39 error: failed to resolve. Could not find `EditMode` in `copperline` [E0433]
src/main.rs:57         mode: copperline::EditMode::Vi
                             ^~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:57:15: 57:39 help: run `rustc --explain E0433` to see a detailed explanation
src/main.rs:61:46: 61:50 error: mismatched types:
 expected `copperline::Encoding`,
    found `&_`
(expected enum `copperline::Encoding`,
    found &-ptr) [E0308]
src/main.rs:61     while let Ok(line) = cl.read_line(">> ", &cfg) {
                                                            ^~~~
src/main.rs:61:46: 61:50 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
error: Could not compile `remnant`.

Am I somehow getting an older version of the library despite specifying 0.3.0? Without any git tags or knowledge of how cargo publishing works, I can't figure out what git commit 0.3.0 is supposed point to.

hjr3 commented

@JayKickliter the 0.3.0 version is from October and it looks like a lot has changed. Use a specific git revision in your Cargo.toml file. I used the current revision of master:

[dependencies]
copperline = { git = "https://github.com/srijs/rust-copperline", rev = "5c12bbe" }
srijs commented

Hi! I haven't been able to release the new version yet, since there is a bug with CJK unicode characters (#1) that I need to fix first.

If you don't require support for CJK characters and would like to take advantage of the new feature, feel free to use the current git version.

If you would like to use the version which is currently on crates.io (0.3.0), you can follow this example code: https://github.com/srijs/rust-copperline/blob/d88df7e1ff4a9999bce68d7ec873d3ec2d743e52/examples/simple.rs