Skip to main content

FieldView

Struct FieldView 

Source
pub struct FieldView<'view, 'a, P> { /* private fields */ }
Expand description

A graph-aware view of a struct or union field.

Implementations§

Source§

impl<'view, 'graph, 'a: 'graph, P: ViewNode<'graph, 'a>> FieldView<'view, 'a, P>

Source

pub fn name(&self) -> StructFieldName<'a>

Returns the field name.

Source

pub fn ty(&self) -> TypeView<'graph, 'a>

Returns a view of the inner type that this type wraps.

Source

pub fn required(&self) -> Required

Returns whether this field is required or optional.

Source

pub fn description(&self) -> Option<&'a str>

Returns the description, if present in the schema.

Source

pub fn flattened(&self) -> bool

Returns true if this field is flattened from an anyOf parent.

Source§

impl<'view, 'graph, 'a> FieldView<'view, 'a, StructView<'graph, 'a>>

Source

pub fn inherited(&self) -> bool

Returns true if this field was inherited from a parent via allOf.

Source

pub fn tag(&self) -> bool

Returns true if this field is a tag.

A field is a tag only if this struct inherits from or is a variant of a tagged union, and the field name matches that union’s tag.

Source

pub fn needs_box(&self) -> bool

Returns true if this field needs Box<T> to break a cycle.

A field needs boxing if its target type is in the same strongly connected component as the type that contains it, excluding edges through heap-allocating containers (arrays and maps).

Trait Implementations§

Source§

impl<'view, 'a, P: Debug> Debug for FieldView<'view, 'a, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'view, 'a, P> Freeze for FieldView<'view, 'a, P>

§

impl<'view, 'a, P> RefUnwindSafe for FieldView<'view, 'a, P>
where P: RefUnwindSafe,

§

impl<'view, 'a, P> Send for FieldView<'view, 'a, P>
where P: Sync,

§

impl<'view, 'a, P> Sync for FieldView<'view, 'a, P>
where P: Sync,

§

impl<'view, 'a, P> Unpin for FieldView<'view, 'a, P>

§

impl<'view, 'a, P> UnsafeUnpin for FieldView<'view, 'a, P>

§

impl<'view, 'a, P> UnwindSafe for FieldView<'view, 'a, P>
where P: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.