pub enum RefOr<T> {
Ref(Ref),
Other(T),
}Expand description
Either a reference to a component or an inline component definition.
This generic type is used throughout the OpenAPI parse tree to represent
locations where a component can either be defined inline, or referenced via
$ref. The RefOr::Ref variant holds a JSON Pointer to a component definition
in the #/components/* section; the RefOr::Other variant holds an
inline definition.
The type uses #[serde(untagged)] to match the OpenAPI specification’s
untagged union semantics, and #[ploidy(pointer(untagged))] for JSON Pointer traversal.
Variants§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for RefOr<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for RefOr<T>where
T: Deserialize<'de>,
Source§fn 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
Source§impl<T> JsonPointee for RefOr<T>where
T: JsonPointee,
impl<T> JsonPointee for RefOr<T>where
T: JsonPointee,
Source§fn resolve(
&self,
pointer: &JsonPointer,
) -> Result<&dyn JsonPointee, JsonPointeeError>
fn resolve( &self, pointer: &JsonPointer, ) -> Result<&dyn JsonPointee, JsonPointeeError>
Resolves a
JsonPointer against this value.Source§impl<'pointee, T> JsonPointerTarget<'pointee> for &'pointee RefOr<T>
impl<'pointee, T> JsonPointerTarget<'pointee> for &'pointee RefOr<T>
Source§fn from_pointee(
pointee: &'pointee dyn JsonPointee,
) -> Result<Self, JsonPointerTargetError>
fn from_pointee( pointee: &'pointee dyn JsonPointee, ) -> Result<Self, JsonPointerTargetError>
Tries to extract
Self from a resolved pointee.Auto Trait Implementations§
impl<T> Freeze for RefOr<T>where
T: Freeze,
impl<T> RefUnwindSafe for RefOr<T>where
T: RefUnwindSafe,
impl<T> Send for RefOr<T>where
T: Send,
impl<T> Sync for RefOr<T>where
T: Sync,
impl<T> Unpin for RefOr<T>where
T: Unpin,
impl<T> UnsafeUnpin for RefOr<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RefOr<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> JsonPointeeExt for Pwhere
P: JsonPointee + ?Sized,
impl<P> JsonPointeeExt for Pwhere
P: JsonPointee + ?Sized,
Source§fn pointer<'a, T>(&'a self, path: &str) -> Result<T, JsonPointerError>where
T: JsonPointerTarget<'a>,
fn pointer<'a, T>(&'a self, path: &str) -> Result<T, JsonPointerError>where
T: JsonPointerTarget<'a>,
Parses a JSON pointer string, resolves it against this value,
and extracts the result as
T.