Struct protobuf::MessageField
source · [−]Expand description
Wrapper around Option<Box<T>>
, convenient newtype.
Examples
let mut customer = Customer::new();
// field of type `SingularPtrField` can be initialized like this
customer.address = MessageField::some(make_address());
// or using `Option` and `Into`
customer.address = Some(make_address()).into();
Tuple Fields
0: Option<Box<T>>
Implementations
Construct SingularPtrField
from given object.
Construct an empty SingularPtrField
.
Construct SingularPtrField
from optional.
Convert into Option<T>
.
Get data as mutable reference. Panics if empty.
Take the data or return supplied default element if empty.
Apply given function to contained data to construct another SingularPtrField
.
Returns empty SingularPtrField
if this object is empty.
Get contained data, consume self. Return default value for type if this is empty.
Set object to Some(T::default())
.
Get a reference to contained value or a default instance.
Get a mutable reference to contained value, initialize if not initialized yet.
Trait Implementations
Returns the “default value” for a type. Read more
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for MessageField<T> where
T: RefUnwindSafe,
impl<T> Send for MessageField<T> where
T: Send,
impl<T> Sync for MessageField<T> where
T: Sync,
impl<T> Unpin for MessageField<T>
impl<T> UnwindSafe for MessageField<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more