Skip to main content

OutputMeta

Struct OutputMeta 

Source
pub struct OutputMeta<'a> {
    pub name: &'a str,
    pub media_type: Option<&'a str>,
    pub framing: Framing,
    pub help: Option<&'a str>,
    pub default: bool,
    pub hide: bool,
    pub select: Option<&'a str>,
    pub schema: Option<&'a str>,
    pub schema_fn: Option<fn() -> String>,
}
Expand description

One thing a command can write.

Fields§

§name: &'a str

The token a user types for it.

§media_type: Option<&'a str>

The media type of the bytes, independent of their stream framing.

§framing: Framing§help: Option<&'a str>§default: bool

What the command writes when nothing selects otherwise.

§hide: bool

Remove an inherited output of the same name.

§select: Option<&'a str>

A boolean flag whose presence picks this output, for the --json spelling.

§schema: Option<&'a str>

A JSON Schema written into the table as text.

What a hand-written table or an include_str!ed file uses. A derive that lowers a Rust type uses Self::schema_fn instead, because schema_for! is a call.

§schema_fn: Option<fn() -> String>

A JSON Schema produced on demand.

A fn pointer for the same reason Completer is one: this lives in a &'static table that a const expression initializes, and a schema derived from a Rust type is a runtime call. Preferred over Self::schema when both are set.

Implementations§

Source§

impl OutputMeta<'_>

Source

pub const EMPTY: OutputMeta<'static>

A named output with nothing else said about it, for struct-update syntax.

Source

pub fn schema_text(&self) -> Option<String>

The schema, whichever way it was declared.

Trait Implementations§

Source§

impl<'a> Clone for OutputMeta<'a>

Source§

fn clone(&self) -> OutputMeta<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for OutputMeta<'a>

Source§

impl<'a> Debug for OutputMeta<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for OutputMeta<'a>

§

impl<'a> RefUnwindSafe for OutputMeta<'a>

§

impl<'a> Send for OutputMeta<'a>

§

impl<'a> Sync for OutputMeta<'a>

§

impl<'a> Unpin for OutputMeta<'a>

§

impl<'a> UnsafeUnpin for OutputMeta<'a>

§

impl<'a> UnwindSafe for OutputMeta<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.