Struct ObjectBuilder
pub struct ObjectBuilder<'a, O> { /* private fields */ }Implementations§
§impl<'a, O> ObjectBuilder<'a, O>
impl<'a, O> ObjectBuilder<'a, O>
pub fn property(
self,
name: &'a str,
value: impl Into<Value>,
) -> ObjectBuilder<'a, O>
pub fn property( self, name: &'a str, value: impl Into<Value>, ) -> ObjectBuilder<'a, O>
Sets property name to the given value value.
Overrides any default or previously defined value for name.
pub fn property_if(
self,
name: &'a str,
value: impl Into<Value>,
predicate: bool,
) -> ObjectBuilder<'a, O>
pub fn property_if( self, name: &'a str, value: impl Into<Value>, predicate: bool, ) -> ObjectBuilder<'a, O>
Sets property name to the given inner value if the predicate evaluates to true.
This has no effect if the predicate evaluates to false,
i.e. default or previous value for name is kept.
pub fn property_if_some(
self,
name: &'a str,
value: Option<impl Into<Value>>,
) -> ObjectBuilder<'a, O>
pub fn property_if_some( self, name: &'a str, value: Option<impl Into<Value>>, ) -> ObjectBuilder<'a, O>
Sets property name to the given inner value if value is Some.
This has no effect if the value is None, i.e. default or previous value for name is kept.
pub fn property_from_iter<V>(
self,
name: &'a str,
iter: impl IntoIterator<Item = impl Into<Value>>,
) -> ObjectBuilder<'a, O>
pub fn property_from_iter<V>( self, name: &'a str, iter: impl IntoIterator<Item = impl Into<Value>>, ) -> ObjectBuilder<'a, O>
Sets property name using the given ValueType V built from iter’s the Items.
Overrides any default or previously defined value for name.
pub fn property_if_not_empty<V>(
self,
name: &'a str,
iter: impl IntoIterator<Item = impl Into<Value>>,
) -> ObjectBuilder<'a, O>
pub fn property_if_not_empty<V>( self, name: &'a str, iter: impl IntoIterator<Item = impl Into<Value>>, ) -> ObjectBuilder<'a, O>
Sets property name using the given ValueType V built from iter’s Items, if iter` is not empty.
This has no effect if iter is empty, i.e. previous property value for name is unchanged.
Auto Trait Implementations§
impl<'a, O> Freeze for ObjectBuilder<'a, O>
impl<'a, O> RefUnwindSafe for ObjectBuilder<'a, O>where
O: RefUnwindSafe,
impl<'a, O> !Send for ObjectBuilder<'a, O>
impl<'a, O> !Sync for ObjectBuilder<'a, O>
impl<'a, O> Unpin for ObjectBuilder<'a, O>where
O: Unpin,
impl<'a, O> UnwindSafe for ObjectBuilder<'a, O>where
O: UnwindSafe,
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
§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> ⓘ
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> ⓘ
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