pub enum Bind {
Registry,
Document,
Render,
Either,
}Expand description
The binding of an option type: where a value for it may be set, on the document, on the render request, on both, or nowhere.
A feature chooses the binding when it declares the option type, and the
binding holds for every caller: a caller of the library never chooses one,
and an option that must be settable in different places for different
purposes is declared as two option types.
Bind::admits says whether a binding lets a value be set in a given
place (BindSite).
It is written to data with Serialize; see serialized
forms.
Variants§
Registry
Fixed when the registry is built: the value is part of the
configuration the feature was constructed with, and the feature holds
it. No value may be set on the document or on the render request, and
building a plan fails (OptionError::RegistryBoundRead) when a stage
declares a read of such a type, since the read could only return the
type’s default. A feature declares its configuration type with this
binding
(SettingsDecl::config),
so that the configuration appears in the registry’s list of option
declarations
(FlmRegistry::options)
and in the settings schema.
Document
Set on the document (Doc::with_options).
Render
Set on the render request
(PlanRequest::render_options).
Either
Set on the document, on the render request, or on both; a value set on the render request replaces the document’s value for the runs of that plan.
Implementations§
Source§impl Bind
impl Bind
Sourcepub fn admits(self, site: BindSite) -> bool
pub fn admits(self, site: BindSite) -> bool
Returns true when this binding lets a value be set in the place
site.
Bind::Registry admits neither place; Bind::Either admits both.
§Examples
use flm_core::model::options::{Bind, BindSite};
assert!(Bind::Either.admits(BindSite::Document));
assert!(Bind::Either.admits(BindSite::Render));
assert!(!Bind::Render.admits(BindSite::Document));
assert!(!Bind::Registry.admits(BindSite::Render));Trait Implementations§
impl Copy for Bind
impl Eq for Bind
Source§impl JsonSchema for Bind
impl JsonSchema for Bind
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Bind
Auto Trait Implementations§
impl Forget for Bind
impl Freeze for Bind
impl Move for Bind
impl RefUnwindSafe for Bind
impl Send for Bind
impl Sync for Bind
impl Unpin for Bind
impl UnsafeUnpin for Bind
impl UnwindSafe for Bind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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