pub struct AdContextBuilder { /* private fields */ }Expand description
Implementations§
Source§impl AdContextBuilder
impl AdContextBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty builder.
§Examples
use tenferro_ad::AdContextBuilder;
let _builder = AdContextBuilder::new();Sourcepub fn with_semantic_extension_rules(
self,
rules: SemanticExtensionRuleSet,
) -> Result<Self, SemanticExtensionRegistryError>
pub fn with_semantic_extension_rules( self, rules: SemanticExtensionRuleSet, ) -> Result<Self, SemanticExtensionRegistryError>
Include an owned semantic-program extension AD rule set.
§Errors
Returns SemanticExtensionRegistryError::MalformedFamilyId when a
family identifier is invalid, or
SemanticExtensionRegistryError::DuplicateRule when the same family
and role were already supplied.
Sourcepub fn build(self) -> Result<AdContext, Infallible>
pub fn build(self) -> Result<AdContext, Infallible>
Build the context.
Semantic extension rules have already been validated and merged by
Self::with_semantic_extension_rules.
§Examples
use tenferro_ad::AdContext;
let ad = AdContext::builder().build().unwrap();
assert!(ad
.semantic_extension_rules()
.lookup_linearize("example.missing.v1")
.is_none());§Errors
The error type is std::convert::Infallible, so this finalization step
never returns Err after semantic rule registration. It retains a
Result so callers can compose it with the fallible registration step.
Trait Implementations§
Source§impl Clone for AdContextBuilder
impl Clone for AdContextBuilder
Source§fn clone(&self) -> AdContextBuilder
fn clone(&self) -> AdContextBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdContextBuilder
impl Debug for AdContextBuilder
Source§impl Default for AdContextBuilder
impl Default for AdContextBuilder
Source§fn default() -> AdContextBuilder
fn default() -> AdContextBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AdContextBuilder
impl !RefUnwindSafe for AdContextBuilder
impl Send for AdContextBuilder
impl Sync for AdContextBuilder
impl Unpin for AdContextBuilder
impl UnsafeUnpin for AdContextBuilder
impl !UnwindSafe for AdContextBuilder
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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