Struct FlagsBuilder
pub struct FlagsBuilder<'a>(/* private fields */);Expand description
Builder for conveniently setting/unsetting flags and returning a Value.
Example for getting a flags property, unsetting some flags and setting the updated flags on the object again:
ⓘ
let flags = obj.property("flags").unwrap();
let flags_class = FlagsClass::new(flags.type_()).unwrap();
let flags = flags_class.builder_with_value(flags).unwrap()
.unset_by_nick("some-flag")
.unset_by_nick("some-other-flag")
.build()
.unwrap();
obj.set_property("flags", &flags).unwrap();If setting/unsetting any value fails, build() returns None.
Implementations§
§impl FlagsBuilder<'_>
impl FlagsBuilder<'_>
pub fn set(self, f: u32) -> FlagsBuilder<'_>
pub fn set(self, f: u32) -> FlagsBuilder<'_>
Set flags corresponding to integer value f.
pub fn set_by_name(self, name: &str) -> FlagsBuilder<'_>
pub fn set_by_name(self, name: &str) -> FlagsBuilder<'_>
Set flags corresponding to string name name.
pub fn set_by_nick(self, nick: &str) -> FlagsBuilder<'_>
pub fn set_by_nick(self, nick: &str) -> FlagsBuilder<'_>
Set flags corresponding to string nick nick.
pub fn unset(self, f: u32) -> FlagsBuilder<'_>
pub fn unset(self, f: u32) -> FlagsBuilder<'_>
Unsets flags corresponding to integer value f.
pub fn unset_by_name(self, name: &str) -> FlagsBuilder<'_>
pub fn unset_by_name(self, name: &str) -> FlagsBuilder<'_>
Unset flags corresponding to string name name.
pub fn unset_by_nick(self, nick: &str) -> FlagsBuilder<'_>
pub fn unset_by_nick(self, nick: &str) -> FlagsBuilder<'_>
Unset flags corresponding to string nick nick.
Auto Trait Implementations§
impl<'a> Freeze for FlagsBuilder<'a>
impl<'a> RefUnwindSafe for FlagsBuilder<'a>
impl<'a> !Send for FlagsBuilder<'a>
impl<'a> !Sync for FlagsBuilder<'a>
impl<'a> Unpin for FlagsBuilder<'a>
impl<'a> UnwindSafe for FlagsBuilder<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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