Trait gigtag::facet::Facet

source ·
pub trait Facet: AsRef<str> + Debug + Default + PartialEq + Ord + Sized {
    // Required methods
    fn from_cow_str(facet: Cow<'_, str>) -> Self;
    fn from_format_args(format_args: Arguments<'_>) -> Self;

    // Provided methods
    fn from_str(facet: &str) -> Self { ... }
    fn from_string(facet: String) -> Self { ... }
    fn from_prefix_with_date_suffix(
        prefix: &str,
        date: Date
    ) -> Result<Self, Format> { ... }
    fn from_prefix_args_with_date_suffix(
        prefix_args: Arguments<'_>,
        date: Date
    ) -> Result<Self, Format> { ... }
    fn is_valid(&self) -> bool { ... }
    fn is_empty(&self) -> bool { ... }
    fn has_date_like_suffix(&self) -> bool { ... }
    fn try_split_into_prefix_and_date_like_suffix(&self) -> Option<(&str, &str)> { ... }
    fn try_split_into_prefix_and_parse_date_suffix(
        &self
    ) -> Option<(&str, Option<Date>)> { ... }
}
Expand description

Common trait for facets

Required Methods§

source

fn from_cow_str(facet: Cow<'_, str>) -> Self

Create a facet from a copy-on-write string.

source

fn from_format_args(format_args: Arguments<'_>) -> Self

Create a facet from a precompiled format string.

Provided Methods§

source

fn from_str(facet: &str) -> Self

Create a facet from a borrowed string slice.

source

fn from_string(facet: String) -> Self

Create a facet from an owned string.

source

fn from_prefix_with_date_suffix( prefix: &str, date: Date ) -> Result<Self, Format>

Concatenate a prefix and Date suffix to a facet.

The prefix string must not end with trailing whitespace, otherwise the resulting facet is invalid.

§Errors

Returns an error if formatting of the given date fails.

source

fn from_prefix_args_with_date_suffix( prefix_args: Arguments<'_>, date: Date ) -> Result<Self, Format>

Concatenate a prefix and Date suffix to a facet.

The prefix string must not end with trailing whitespace, otherwise the resulting facet is invalid.

§Errors

Returns an error if formatting of the given date fails.

source

fn is_valid(&self) -> bool

source

fn is_empty(&self) -> bool

source

fn has_date_like_suffix(&self) -> bool

source

fn try_split_into_prefix_and_date_like_suffix(&self) -> Option<(&str, &str)>

source

fn try_split_into_prefix_and_parse_date_suffix( &self ) -> Option<(&str, Option<Date>)>

Object Safety§

This trait is not object safe.

Implementors§