[−][src]Trait openapi_utils::ReferenceOrExt
This extension deals with ReferenceOr
enums in the spec
All these methods assume the spec has been previously dereferenced,
see the deref_all
method in the spec object.
These methods are still needed because structs hold ReferenceOr
enums, although
these enums always have an item, never a reference.
Required methods
fn to_item(self) -> T
Consumes the ReferenceOr
and returns the iternal Item
fn to_item_ref(&self) -> &T
Returns reference to internal Item for a ReferenceOr
fn to_item_mut(&mut self) -> &mut T
Returns mutable reference to internal Item for a ReferenceOr
Implementations on Foreign Types
impl<T> ReferenceOrExt<T> for ReferenceOr<T>
[src]
fn to_item(self) -> T
[src]
to_item_*
functions return the item of a reference without searching
These functions will panic if they find a reference. They
Are used as convenience methods in a document already dereferenced.
Examples
let item = ReferenceOr::Item(3); assert_eq!(to_item(item), 3);
fn to_item_ref(&self) -> &T
[src]
Examples
let item = ReferenceOr::Item(3); assert_eq!(to_item_ref(&item), &3);
fn to_item_mut(&mut self) -> &mut T
[src]
Examples
let mut item = ReferenceOr::Item(3); assert_eq!(to_item_mut(&mut item), &3);