Skip to main content

ExportSpec

Struct ExportSpec 

Source
pub struct ExportSpec {
    pub name: String,
    pub label: Option<String>,
    pub gate: Gate,
    pub view: Option<String>,
}
Expand description

One export a workspace declares for itself: a gate that bounds what leaves, optionally arranged by a view.

Fields§

§name: String

The key under exports — the export’s public handle (a path segment, an OCFL object prefix). Deliberately its own name rather than the gate value’s: the honest name for a readership is routinely one its members should never read off a URL, and separating them lets two gates share an arrangement or one gate carry two exports.

§label: Option<String>

What a person calls it. Absent falls back to the name, humanized.

§gate: Gate

The gate whose admitted set bounds this export. Required: an export that does not say what may leave is not an export.

§view: Option<String>

The ViewSpec naming this export’s arrangement, by its key under views:. None exports the gate’s whole admitted set. A view may narrow the set; it can never widen it — see plan.

Implementations§

Source§

impl ExportSpec

Source

pub fn parse(name: &str, value: &Value) -> Option<ExportSpec>

Read one exports.<name> entry.

Returns None when the entry is not a mapping or carries no readable Gate. Dropping such an entry is the fail-closed direction — an unreadable export declaration exports nothing, where defaulting its gate would export a set nobody chose. crate::diagnose_export is the half that says why, so a malformed entry is reported rather than merely dropped.

Source

pub fn to_mapping(&self) -> IndexMap<String, Value>

The mapping this export writes back as. Absent options are omitted rather than written empty, so an export declared from an app reads as the small thing it is.

Source

pub fn display_label(&self) -> String

What a person calls this export: its label, else its name humanized.

Trait Implementations§

Source§

impl Clone for ExportSpec

Source§

fn clone(&self) -> ExportSpec

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 Debug for ExportSpec

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ExportSpec

Source§

impl PartialEq for ExportSpec

Source§

fn eq(&self, other: &ExportSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ExportSpec

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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 = 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.