pub struct Field<'buf> { /* private fields */ }Expand description
An object field; upholds the invariant that the inner Element’s path ends with a key.
Implementations§
Source§impl<'buf> Field<'buf>
impl<'buf> Field<'buf>
Sourcepub fn into_element(self) -> Element<'buf>
pub fn into_element(self) -> Element<'buf>
Consume the Field and return the inner Element.
Sourcepub fn full_span(&self) -> Span
pub fn full_span(&self) -> Span
Returns the span covering "key": value plus any trailing comma and the whitespace
after it, so the span ends where the next field begins.
When there is no trailing comma (the last field), full_span() covers
"key": value only.
As with Element::full_span, removing a field is not simply a matter of erasing
this span; use Document::removal_spans. Erasing the full_span of a last field
leaves a dangling comma on the field before it, and a field’s value cannot be
erased on its own without leaving a key with nothing after the colon.
Sourcepub fn source_json(&self) -> &'buf str
pub fn source_json(&self) -> &'buf str
Returns the slice of the source JSON spanning "key": value.
Trait Implementations§
impl<'buf> Eq for Field<'buf>
impl<'buf> StructuralPartialEq for Field<'buf>
Auto Trait Implementations§
impl<'buf> !Send for Field<'buf>
impl<'buf> !Sync for Field<'buf>
impl<'buf> Freeze for Field<'buf>
impl<'buf> RefUnwindSafe for Field<'buf>
impl<'buf> Unpin for Field<'buf>
impl<'buf> UnsafeUnpin for Field<'buf>
impl<'buf> UnwindSafe for Field<'buf>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoCaveat for T
impl<T> IntoCaveat for T
Source§fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
Any type can be converted to
Caveat<T> by supplying a list of Warnings.Source§fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
If a
FromSchema is infallible a Caveat can be created using this method.