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 more
sourceimpl<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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ReferenceOr<T>) -> bool
fn ne(&self, other: &ReferenceOr<T>) -> bool
This method tests for !=
.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more