pub struct ModelProfile { /* private fields */ }Expand description
Model-side profile: the specification revision plus the set of enabled extensions that together describe what features a template or job may use.
ModelProfile is the openjd-model counterpart of
openjd_expr::ExprProfile. Both crates share the pattern:
openjd-expr:ExprProfiledrivesFunctionLibrary::for_profile. Its third axis isHostContext— host-supplied runtime state (path mapping rules).openjd-model:ModelProfiledrives template validation and job creation. Caller policy is orthogonal and carried separately inCallerLimits; the two are bundled into aValidationContextwhere both are needed together.
Profiles are small value types: clone them freely, store them on
sessions, pass them by reference into validators. ModelProfile
has no mutable operations other than builder-style with_*
methods that return a new profile.
Use ModelProfile::to_expr_profile to derive a matching
ExprProfile when calling into openjd-expr; the caller supplies
the appropriate HostContext for their situation.
Implementations§
Source§impl ModelProfile
impl ModelProfile
Sourcepub fn new(revision: SpecificationRevision) -> Self
pub fn new(revision: SpecificationRevision) -> Self
Build a profile for the given revision with no extensions enabled.
Sourcepub fn with_extensions(self, extensions: Extensions) -> Self
pub fn with_extensions(self, extensions: Extensions) -> Self
Set the enabled extensions (replaces any existing set).
Sourcepub fn revision(&self) -> SpecificationRevision
pub fn revision(&self) -> SpecificationRevision
The specification revision this profile targets.
Sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
The set of extensions this profile enables.
Sourcepub fn has_extension(&self, ext: ModelExtension) -> bool
pub fn has_extension(&self, ext: ModelExtension) -> bool
True iff ext is enabled in this profile.
Sourcepub fn to_expr_profile(&self, host_context: HostContext) -> ExprProfile
pub fn to_expr_profile(&self, host_context: HostContext) -> ExprProfile
Derive an ExprProfile matching this
profile’s revision and extensions, with the caller-specified
HostContext.
This is the bridge from openjd-model to openjd-expr: call
this and pass the result to
FunctionLibrary::for_profile.
The host_context argument is a caller responsibility because
the model has no opinion on it — template validation uses
HostContext::Unresolved,
runtime session work uses
HostContext::WithRules,
and pure-template work (e.g. resolving the job name) uses
HostContext::None.
Trait Implementations§
Source§impl Clone for ModelProfile
impl Clone for ModelProfile
Source§fn clone(&self) -> ModelProfile
fn clone(&self) -> ModelProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ModelProfile
impl RefUnwindSafe for ModelProfile
impl Send for ModelProfile
impl Sync for ModelProfile
impl Unpin for ModelProfile
impl UnsafeUnpin for ModelProfile
impl UnwindSafe for ModelProfile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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