Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example is missing .clone() #1

Open
blinry opened this issue Mar 12, 2024 · 0 comments
Open

Example is missing .clone() #1

blinry opened this issue Mar 12, 2024 · 0 comments

Comments

@blinry
Copy link

blinry commented Mar 12, 2024

The example code in the README seems to be missing .clone() invocations. Here's the code we think would be correct:

use kyte::{Compose, Delta, Transform};

fn main() {
    let before = Delta::new().insert("Hello World".to_owned(), ());

    let alice = Delta::new().retain(5, ()).insert(",".to_owned(), ());
    let bob = Delta::new().retain(11, ()).insert("!".to_owned(), ());

    let composed_1 = before.clone()
            .compose(alice.clone())
            .compose(dbg!(alice.clone().transform(bob.clone(), true)));
    let composed_2 = before.clone()
            .compose(bob.clone())
            .compose(dbg!(bob.clone().transform(alice.clone(), false)));

    assert_eq!(composed_1, composed_2);
    println!("{:?}", composed_1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant