pub struct GrammarFormatProfile { /* private fields */ }Expand description
Capability profile for one grammar notation.
The embedded LanguageProfile carries the support-or-fallback invariant
used by the document fidelity matrix. equivalent_constructs marks
supported constructs whose round trip is semantically equivalent but not
byte/canonical-form lossless.
Implementations§
Source§impl GrammarFormatProfile
impl GrammarFormatProfile
Sourcepub const fn new(format: &'static str, profile: LanguageProfile) -> Self
pub const fn new(format: &'static str, profile: LanguageProfile) -> Self
Creates a grammar format profile around a LanguageProfile.
Sourcepub fn with_lossless_construct(self, construct: impl Into<String>) -> Self
pub fn with_lossless_construct(self, construct: impl Into<String>) -> Self
Returns this profile with a lossless construct.
Sourcepub fn with_equivalent_construct(self, construct: impl Into<String>) -> Self
pub fn with_equivalent_construct(self, construct: impl Into<String>) -> Self
Returns this profile with an equivalent construct.
Sourcepub fn with_lossy_fallback(
self,
construct: impl Into<String>,
fallback: impl Into<String>,
) -> Self
pub fn with_lossy_fallback( self, construct: impl Into<String>, fallback: impl Into<String>, ) -> Self
Returns this profile with a documented lossy fallback for a construct.
Sourcepub const fn language_profile(&self) -> &LanguageProfile
pub const fn language_profile(&self) -> &LanguageProfile
Underlying language profile.
Sourcepub const fn fallbacks(&self) -> &BTreeMap<String, String>
pub const fn fallbacks(&self) -> &BTreeMap<String, String>
Lossy fallback table keyed by construct id.
Sourcepub const fn equivalent_constructs(&self) -> &BTreeSet<String>
pub const fn equivalent_constructs(&self) -> &BTreeSet<String>
Constructs represented through equivalent spelling or normalization.
Sourcepub fn supports_construct(&self, construct: &str) -> bool
pub fn supports_construct(&self, construct: &str) -> bool
Whether this format represents a construct without a lossy fallback.
Sourcepub fn construct_fallback(&self, construct: &str) -> Option<&str>
pub fn construct_fallback(&self, construct: &str) -> Option<&str>
Documented lossy fallback for a construct this format cannot represent natively.
Sourcepub fn construct_fidelity(
&self,
construct: &str,
) -> Option<GrammarFidelityLevel>
pub fn construct_fidelity( &self, construct: &str, ) -> Option<GrammarFidelityLevel>
Fidelity level for a construct, or None when the construct is outside
this profile’s vocabulary.
Trait Implementations§
Source§impl Clone for GrammarFormatProfile
impl Clone for GrammarFormatProfile
Source§fn clone(&self) -> GrammarFormatProfile
fn clone(&self) -> GrammarFormatProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrammarFormatProfile
impl Debug for GrammarFormatProfile
Source§impl PartialEq for GrammarFormatProfile
impl PartialEq for GrammarFormatProfile
Source§fn eq(&self, other: &GrammarFormatProfile) -> bool
fn eq(&self, other: &GrammarFormatProfile) -> bool
self and other values to be equal, and is used by ==.impl Eq for GrammarFormatProfile
impl StructuralPartialEq for GrammarFormatProfile
Auto Trait Implementations§
impl Freeze for GrammarFormatProfile
impl RefUnwindSafe for GrammarFormatProfile
impl Send for GrammarFormatProfile
impl Sync for GrammarFormatProfile
impl Unpin for GrammarFormatProfile
impl UnsafeUnpin for GrammarFormatProfile
impl UnwindSafe for GrammarFormatProfile
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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