Enum openapiv3::ReferenceOr
source · [−]pub enum ReferenceOr<T> {
Reference {
reference: String,
},
Item(T),
}
Variants
Reference
Fields
reference: String
Item(T)
Implementations
sourceimpl<T> ReferenceOr<T>
impl<T> ReferenceOr<T>
pub fn ref_(r: &str) -> Self
pub fn boxed_item(item: T) -> ReferenceOr<Box<T>>
sourcepub fn into_item(self) -> Option<T>
pub fn into_item(self) -> Option<T>
Converts this ReferenceOr to the item inside, if it exists.
The return value will be Option::Some if this was a ReferenceOr::Item or Option::None if this was a ReferenceOr::Reference.
Examples
let i = ReferenceOr::Item(1);
assert_eq!(i.into_item(), Some(1));
let j: ReferenceOr<u8> = ReferenceOr::Reference { reference: String::new() };
assert_eq!(j.into_item(), None);
sourcepub fn as_item(&self) -> Option<&T>
pub fn as_item(&self) -> Option<&T>
Returns a reference to to the item inside this ReferenceOr, if it exists.
The return value will be Option::Some if this was a ReferenceOr::Item or Option::None if this was a ReferenceOr::Reference.
Examples
let i = ReferenceOr::Item(1);
assert_eq!(i.as_item(), Some(&1));
let j: ReferenceOr<u8> = ReferenceOr::Reference { reference: String::new() };
assert_eq!(j.as_item(), None);
sourceimpl<T> ReferenceOr<Box<T>>
impl<T> ReferenceOr<Box<T>>
pub fn unbox(self) -> ReferenceOr<T>
Trait Implementations
sourceimpl<T: Clone> Clone for ReferenceOr<T>
impl<T: Clone> Clone for ReferenceOr<T>
sourcefn clone(&self) -> ReferenceOr<T>
fn clone(&self) -> ReferenceOr<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<T: Debug> Debug for ReferenceOr<T>
impl<T: Debug> Debug for ReferenceOr<T>
sourceimpl<'de, T> Deserialize<'de> for ReferenceOr<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ReferenceOr<T>where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: PartialEq> PartialEq<ReferenceOr<T>> for ReferenceOr<T>
impl<T: PartialEq> PartialEq<ReferenceOr<T>> for ReferenceOr<T>
sourcefn eq(&self, other: &ReferenceOr<T>) -> bool
fn eq(&self, other: &ReferenceOr<T>) -> bool
sourceimpl<T> Serialize for ReferenceOr<T>where
T: Serialize,
impl<T> Serialize for ReferenceOr<T>where
T: Serialize,
impl<T> StructuralPartialEq for ReferenceOr<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for ReferenceOr<T>where
T: RefUnwindSafe,
impl<T> Send for ReferenceOr<T>where
T: Send,
impl<T> Sync for ReferenceOr<T>where
T: Sync,
impl<T> Unpin for ReferenceOr<T>where
T: Unpin,
impl<T> UnwindSafe for ReferenceOr<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more