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

It is no longer possible to enable timestamping programatically #1511

Closed
joaofl opened this issue Oct 4, 2024 · 1 comment
Closed

It is no longer possible to enable timestamping programatically #1511

joaofl opened this issue Oct 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joaofl
Copy link

joaofl commented Oct 4, 2024

Description of the Issue

Before 1.0.0.beta-4, I used to enable timestamping with zenoh::Config. With the new release (beta4) it is no longer possible, but only with zenoh_config::Config, which in turn cannot be used to open a session.
It is not clear the relationship between the two config constructors, and how to go from one to the other one.

See some annotated code that exemplify my issue more clearly:

fn setup_zenoh() -> Result<zenoh::Session, zenoh::Error> {
    let mut config_ext = zenoh_config::Config::default();
    config_ext.timestamping.set_enabled(Some(ModeDependentValue::Unique(true)));

    let mut config = zenoh::Config::default();
    // Below line no longer compiles
    //config.timestamping.set_enabled(Some(ModeDependentValue::Unique(true)));

    println!("Opening session...");
    // Below line does not work
    //let session = zenoh::open(config_ext).wait().unwrap();

    let session = zenoh::open(config).wait().unwrap();
    Ok(session)
}

When debugging, I can see that the same config structure is now inside this tuple 0 inside config:

image

And when I try to explicitly convert one into the other, I get this issue:

the trait bound `zenoh::Config: From<zenoh_config::Config>` is not satisfied
required for `zenoh_config::Config` to implement `Into<zenoh::Config>`
required for `zenoh::Config` to implement `TryFrom<zenoh_config::Config>`

To reproduce

Run the code snippet attached.

System info

Fedora 39
zenoh = "1.0.0-beta.4"
zenoh-config = "1.0.0-beta.4"
zenoh-ext = "1.0.0-beta.4"

@joaofl joaofl added the bug Something isn't working label Oct 4, 2024
@joaofl joaofl changed the title Is is no longer clear how to enable timestamping programatically on 1.0.0.beta-4 It is no longer possible to enable timestamping programatically Oct 4, 2024
@joaofl
Copy link
Author

joaofl commented Oct 4, 2024

Enabling internal_config made the config accessible again:

zenoh = {version = "1.0.0-beta.4", features = ["internal_config"] }

and the code below works again:

fn setup_zenoh() -> Result<zenoh::Session, zenoh::Error> {
    let mut config = zenoh::Config::default();
    config.timestamping.set_enabled(Some(ModeDependentValue::Unique(true)));

    let session = zenoh::open(config).wait().unwrap();
    Ok(session)
}

@joaofl joaofl closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant