Struct protobuf::SingularPtrField [−][src]
Like Option<Box<T>>
, but keeps the actual element on clear
.
Implementations
impl<T> SingularPtrField<T>
[src]
pub fn some(value: T) -> SingularPtrField<T>
[src]
Construct SingularPtrField
from given object.
pub fn none() -> SingularPtrField<T>
[src]
Construct an empty SingularPtrField
.
pub fn from_option(option: Option<T>) -> SingularPtrField<T>
[src]
Construct SingularPtrField
from optional.
pub fn is_some(&self) -> bool
[src]
True iff this object contains data.
pub fn is_none(&self) -> bool
[src]
True iff this object contains no data.
pub fn into_option(self) -> Option<T>
[src]
Convert into Option<T>
.
pub fn as_ref<'a>(&'a self) -> Option<&'a T>
[src]
View data as reference option.
pub fn as_mut<'a>(&'a mut self) -> Option<&'a mut T>
[src]
View data as mutable reference option.
pub fn get_ref<'a>(&'a self) -> &'a T
[src]
Get data as reference. Panics if empty.
pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T
[src]
Get data as mutable reference. Panics if empty.
pub fn unwrap(self) -> T
[src]
Take the data. Panics if empty
pub fn unwrap_or(self, def: T) -> T
[src]
Take the data or return supplied default element if empty.
pub fn unwrap_or_else<F>(self, f: F) -> T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
Take the data or return supplied default element if empty.
pub fn map<U, F>(self, f: F) -> SingularPtrField<U> where
F: FnOnce(T) -> U,
[src]
F: FnOnce(T) -> U,
Apply given function to contained data to construct another SingularPtrField
.
Returns empty SingularPtrField
if this object is empty.
pub fn iter<'a>(&'a self) -> IntoIter<&'a T>
[src]
View data as iterator.
pub fn mut_iter<'a>(&'a mut self) -> IntoIter<&'a mut T>
[src]
View data as mutable iterator.
pub fn take(&mut self) -> Option<T>
[src]
Take data as option, leaving this object empty.
pub fn clear(&mut self)
[src]
Clear this object, but do not call destructor of underlying data.
impl<T: Default + Clear> SingularPtrField<T>
[src]
pub fn unwrap_or_default(self) -> T
[src]
Get contained data, consume self. Return default value for type if this is empty.
pub fn set_default<'a>(&'a mut self) -> &'a mut T
[src]
Initialize this object with default value. This operation can be more efficient then construction of clear element, because it may reuse previously contained object.
Trait Implementations
impl<T: Clone> Clone for SingularPtrField<T>
[src]
fn clone(&self) -> SingularPtrField<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for SingularPtrField<T>
[src]
impl<T> Default for SingularPtrField<T>
[src]
fn default() -> SingularPtrField<T>
[src]
impl<T: Eq> Eq for SingularPtrField<T>
[src]
impl<T> From<Option<T>> for SingularPtrField<T>
[src]
impl<T: Hash> Hash for SingularPtrField<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T> IntoIterator for &'a SingularPtrField<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = IntoIter<&'a T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> IntoIter<&'a T>
[src]
impl<T: PartialEq> PartialEq<SingularPtrField<T>> for SingularPtrField<T>
[src]
fn eq(&self, other: &SingularPtrField<T>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: PbPrint> PbPrint for SingularPtrField<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for SingularPtrField<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for SingularPtrField<T> where
T: Send,
T: Send,
impl<T> Sync for SingularPtrField<T> where
T: Sync,
T: Sync,
impl<T> Unpin for SingularPtrField<T>
impl<T> UnwindSafe for SingularPtrField<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,