Skip to content

Update properties whihout setter #955

Closed Answered by gnulux
gnulux asked this question in Q&A
Discussion options

You must be logged in to vote

Hi zeenix,

you were right the scope was the issue it works now . a big thank to you



use tokio::{task, time::Duration};
use zbus::names::InterfaceName;
use zbus::{connection, interface, SignalContext};
use zbus::fdo::PropertiesProxy;
use zbus::{Connection, Result, zvariant};
use zvariant::{OwnedValue};



#[derive(Clone)] 
struct Greeter {
    offset: i32,
}


#[interface(name = "org.example.TestInterface")]
impl Greeter {
 
    /// A "GreeterName" property.
    #[zbus(property)]
    async fn offset(&self) -> i32 {
        self.offset
    }
    
    //#[zbus(property)]
    async fn  set_offset(&mut self, o: i32) {
        self.offset = o;
        println!("Update offset is called with va…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gnulux
Comment options

Answer selected by gnulux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants