Smithay / calloop

A callback-based Event Loop
MIT License
176 stars 34 forks source link

Storing registration token in structure #138

Closed chiru091096 closed 1 year ago

chiru091096 commented 1 year ago

Hi, I want to store the RegistrationToken returned by insert_source in a structure as below example. What is the right way to initialize the token variable to a default value..

struct Test {
    token : RegistrationToken,
}

impl Test{
    new() ->Test {
       return Test {
           token : // how to initialize to dummy/default RegistrationToken value
       };
    }
}

Any help on this will be appreciated..

elinorbgr commented 1 year ago

Is there something preventing you from using an Option<_> ?

chiru091096 commented 1 year ago

I'll try that, thanks