pub struct TargetCatalog(/* private fields */);Expand description
An encoder’s synthesis targets and its optional cross-format default.
The default is a position in targets, validated when the catalog is
constructed. A catalog may have no default when the encoder cannot
synthesize a document from a source of another format.
Implementations§
Source§impl TargetCatalog
impl TargetCatalog
Sourcepub const fn empty(namespace: &'static str) -> Self
pub const fn empty(namespace: &'static str) -> Self
Builds an empty catalog for a dialect-free format.
Sourcepub const fn new(
targets: &'static [TargetDescriptor],
default: Option<usize>,
) -> Self
pub const fn new( targets: &'static [TargetDescriptor], default: Option<usize>, ) -> Self
Builds a nonempty catalog with one namespace and an optional default row.
Panics if rows have different namespaces, a spelling selects multiple rows, or the default is out of bounds.
Sourcepub const fn targets(self) -> &'static [TargetDescriptor]
pub const fn targets(self) -> &'static [TargetDescriptor]
Returns all synthesis targets in catalog order.
Sourcepub fn iter(self) -> Iter<'static, TargetDescriptor> ⓘ
pub fn iter(self) -> Iter<'static, TargetDescriptor> ⓘ
Iterates over synthesis targets in catalog order.
Sourcepub fn find(self, token: &str) -> Option<(usize, &'static TargetDescriptor)>
pub fn find(self, token: &str) -> Option<(usize, &'static TargetDescriptor)>
Returns the row named by a full id, format-local id, or alias, with its position.
Sourcepub fn default(self) -> Option<(usize, &'static TargetDescriptor)>
pub fn default(self) -> Option<(usize, &'static TargetDescriptor)>
Returns the cross-format default and its position, when declared.
Trait Implementations§
Source§impl Clone for TargetCatalog
impl Clone for TargetCatalog
impl Copy for TargetCatalog
Source§impl Debug for TargetCatalog
impl Debug for TargetCatalog
impl Eq for TargetCatalog
Source§impl IntoIterator for TargetCatalog
impl IntoIterator for TargetCatalog
Source§impl PartialEq for TargetCatalog
impl PartialEq for TargetCatalog
Source§impl Serialize for TargetCatalog
impl Serialize for TargetCatalog
impl StructuralPartialEq for TargetCatalog
Auto Trait Implementations§
impl Freeze for TargetCatalog
impl RefUnwindSafe for TargetCatalog
impl Send for TargetCatalog
impl Sync for TargetCatalog
impl Unpin for TargetCatalog
impl UnsafeUnpin for TargetCatalog
impl UnwindSafe for TargetCatalog
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