pub struct RegistryBuilder { /* private fields */ }
Expand description
Helper for constructing a |Registry|.
A proper registry implementation can support adding and removing |Global|s at runtime. Since we do not yet support these features, we will only allow |Global|s to be added at initialization time and then leave the |Registry| immutable.
Note: the |Registry| only works for single-threaded event loops.
TODO(tjdetwiler): Allow interfaces to be added and removed from the |Registry| dynamically.
Implementations§
Source§impl RegistryBuilder
impl RegistryBuilder
pub fn new() -> Self
Sourcepub fn add_global<I: Interface + 'static, F: FnMut(ObjectId, u32, &mut Client) -> Result<Box<dyn MessageReceiver>, Error> + Send + 'static>(
&mut self,
_: I,
bind: F,
) -> &mut Self
pub fn add_global<I: Interface + 'static, F: FnMut(ObjectId, u32, &mut Client) -> Result<Box<dyn MessageReceiver>, Error> + Send + 'static>( &mut self, _: I, bind: F, ) -> &mut Self
Adds a new global interface to the registry.
The wayland interface name & version are identified by the |Interface| provided. When a client attempts to bind to this global using |wl_registry::bind|, the closure will be called to create a |MessageReceiver| that will be use to handle requests to the instance of that global.
pub fn build(&mut self) -> Registry
Auto Trait Implementations§
impl Freeze for RegistryBuilder
impl !RefUnwindSafe for RegistryBuilder
impl Send for RegistryBuilder
impl !Sync for RegistryBuilder
impl Unpin for RegistryBuilder
impl !UnwindSafe for RegistryBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more