pub struct AllowedSpecifier {
pub types: u16,
pub alternate_forms: u8,
pub allowed_fill_characters: Option<String>,
pub forbidden_fill_characters: Option<String>,
pub alignments: u8,
pub signs: u8,
pub pad_zeros: u8,
pub allowed_widths: Option<Vec<Width>>,
pub forbidden_widths: Option<Vec<Width>>,
pub allowed_precisions: Option<Vec<Precision>>,
pub forbidden_precisions: Option<Vec<Precision>>,
}Expand description
Helper structure to specify the constraints of an expected argument.
use dfmt::*;
let allowed_specifier =
AllowedSpecifier::all()
.forbid(Type::Display);
assert!(Template::parse("Hello, {world}!").unwrap()
.expect_argument("world", &allowed_specifier)
.is_err());Fields§
§types: u16§alternate_forms: u8§allowed_fill_characters: Option<String>§forbidden_fill_characters: Option<String>§alignments: u8§signs: u8§pad_zeros: u8§allowed_widths: Option<Vec<Width>>§forbidden_widths: Option<Vec<Width>>§allowed_precisions: Option<Vec<Precision>>§forbidden_precisions: Option<Vec<Precision>>Implementations§
Trait Implementations§
Source§impl AllowedSpecifierBuilder<AlternateForm> for AllowedSpecifier
impl AllowedSpecifierBuilder<AlternateForm> for AllowedSpecifier
fn allow(self, constraint: AlternateForm) -> Self
fn forbid(self, constraint: AlternateForm) -> Self
Source§impl AllowedSpecifierBuilder<Option<Vec<Precision>>> for AllowedSpecifier
impl AllowedSpecifierBuilder<Option<Vec<Precision>>> for AllowedSpecifier
Source§impl AllowedSpecifierBuilder<Option<Vec<Width>>> for AllowedSpecifier
impl AllowedSpecifierBuilder<Option<Vec<Width>>> for AllowedSpecifier
Source§impl Clone for AllowedSpecifier
impl Clone for AllowedSpecifier
Source§fn clone(&self) -> AllowedSpecifier
fn clone(&self) -> AllowedSpecifier
Returns a duplicate of the value. Read more
1.0.0 · 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 AllowedSpecifier
impl Debug for AllowedSpecifier
Source§impl PartialEq for AllowedSpecifier
impl PartialEq for AllowedSpecifier
impl Eq for AllowedSpecifier
impl StructuralPartialEq for AllowedSpecifier
Auto Trait Implementations§
impl Freeze for AllowedSpecifier
impl RefUnwindSafe for AllowedSpecifier
impl Send for AllowedSpecifier
impl Sync for AllowedSpecifier
impl Unpin for AllowedSpecifier
impl UnwindSafe for AllowedSpecifier
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