pub struct CrossDomainMapper { /* private fields */ }Expand description
Translates ternary patterns between different domains.
Domains are identified by string names. Each domain has a mapping that interprets ternary values in its own context.
Implementations§
Source§impl CrossDomainMapper
impl CrossDomainMapper
pub fn new() -> Self
Sourcepub fn register_domain(
&mut self,
name: &str,
negative_label: &str,
zero_label: &str,
positive_label: &str,
)
pub fn register_domain( &mut self, name: &str, negative_label: &str, zero_label: &str, positive_label: &str, )
Register a domain with its ternary value interpretations.
Sourcepub fn translate(
&self,
pattern: &Pattern,
from_domain: &str,
to_domain: &str,
) -> Option<Vec<String>>
pub fn translate( &self, pattern: &Pattern, from_domain: &str, to_domain: &str, ) -> Option<Vec<String>>
Translate a pattern from one domain’s interpretation to another’s. The ternary values stay the same; only the labels change.
Sourcepub fn label_for(&self, domain: &str, value: Ternary) -> Option<&str>
pub fn label_for(&self, domain: &str, value: Ternary) -> Option<&str>
Get the label for a value in a specific domain.
Sourcepub fn domain_names(&self) -> Vec<&str>
pub fn domain_names(&self) -> Vec<&str>
List registered domain names.
Trait Implementations§
Source§impl Clone for CrossDomainMapper
impl Clone for CrossDomainMapper
Source§fn clone(&self) -> CrossDomainMapper
fn clone(&self) -> CrossDomainMapper
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 moreAuto Trait Implementations§
impl Freeze for CrossDomainMapper
impl RefUnwindSafe for CrossDomainMapper
impl Send for CrossDomainMapper
impl Sync for CrossDomainMapper
impl Unpin for CrossDomainMapper
impl UnsafeUnpin for CrossDomainMapper
impl UnwindSafe for CrossDomainMapper
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