Skip to main content

Variable

Struct Variable 

Source
pub struct Variable {
    pub name: String,
    pub optional: bool,
    pub secret: bool,
    pub host: bool,
    pub ty: Option<String>,
    pub about: Option<String>,
    pub default: Option<Value>,
}
Expand description

One variable a file declares under $vars (SPEC 4.5).

Fields§

§name: String

Its name.

§optional: bool

optional: true

§secret: bool

secret: true: kept out of debug output, problems and traces.

§host: bool

host: true: the application sets it itself.

§ty: Option<String>

type, as written.

§about: Option<String>

about

§default: Option<Value>

default

Implementations§

Source§

impl Variable

Source

pub fn required(&self) -> bool

The application must pass it: no default and not optional.

Source

pub fn mismatch(&self, value: &Value) -> Option<String>

Why a value does not fit the declared type.

Trait Implementations§

Source§

impl Clone for Variable

Source§

fn clone(&self) -> Self

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 Variable

Source§

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

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

impl PartialEq for Variable

Source§

fn eq(&self, other: &Self) -> 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 Variable

Auto Trait Implementations§

§

impl !RefUnwindSafe for Variable

§

impl !UnwindSafe for Variable

§

impl Forget for Variable

§

impl Freeze for Variable
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, *const ArcInner<[Value]> is !null: Freeze, PhantomData<ArcInner<[Value]>>: Freeze, *const ArcInner<IndexMap<Arc<str>, Value>> is !null: Freeze, PhantomData<ArcInner<IndexMap<Arc<str>, Value>>>: Freeze, NonZero<i32>: Freeze, *const ArcInner<Range> is !null: Freeze, PhantomData<ArcInner<Range>>: Freeze, *const ArcInner<Function> is !null: Freeze, PhantomData<ArcInner<Function>>: Freeze, *const ArcInner<dyn HostValue> is !null: Freeze, PhantomData<ArcInner<dyn HostValue>>: Freeze,

§

impl Move for Variable

§

impl Send for Variable
where RawVecInner: Send, Arc<str>: Send, Arc<[Value]>: Send, Arc<IndexMap<Arc<str>, Value>>: Send, NonZero<i32>: Send, Arc<Range>: Send, Arc<Function>: Send, Arc<dyn HostValue>: Send,

§

impl Sync for Variable
where RawVecInner: Sync, Arc<str>: Sync, Arc<[Value]>: Sync, Arc<IndexMap<Arc<str>, Value>>: Sync, NonZero<i32>: Sync, Arc<Range>: Sync, Arc<Function>: Sync, Arc<dyn HostValue>: Sync,

§

impl Unpin for Variable

§

impl UnsafeUnpin for Variable
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin, *const ArcInner<[Value]> is !null: UnsafeUnpin, PhantomData<ArcInner<[Value]>>: UnsafeUnpin, *const ArcInner<IndexMap<Arc<str>, Value>> is !null: UnsafeUnpin, PhantomData<ArcInner<IndexMap<Arc<str>, Value>>>: UnsafeUnpin, NonZeroI32Inner: UnsafeUnpin, *const ArcInner<Range> is !null: UnsafeUnpin, PhantomData<ArcInner<Range>>: UnsafeUnpin, *const ArcInner<Function> is !null: UnsafeUnpin, PhantomData<ArcInner<Function>>: UnsafeUnpin, *const ArcInner<dyn HostValue> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn HostValue>>: UnsafeUnpin,

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, !>

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.