Skip to main content

StringFlags

Trait StringFlags 

Source
pub trait StringFlags: Copy {
    // Required methods
    fn quote_style(self) -> Quote;
    fn triple_quotes(self) -> TripleQuotes;
    fn prefix(self) -> AnyStringPrefix;
    fn is_unclosed(self) -> bool;

    // Provided methods
    fn is_triple_quoted(self) -> bool { ... }
    fn quote_str(self) -> &'static str { ... }
    fn quote_len(self) -> TextSize { ... }
    fn opener_len(self) -> TextSize { ... }
    fn closer_len(self) -> TextSize { ... }
    fn as_any_string_flags(self) -> AnyStringFlags { ... }
    fn display_contents(self, contents: &str) -> DisplayFlags<'_> { ... }
}

Required Methods§

Source

fn quote_style(self) -> Quote

Does the string use single or double quotes in its opener and closer?

Source

fn triple_quotes(self) -> TripleQuotes

Source

fn prefix(self) -> AnyStringPrefix

Source

fn is_unclosed(self) -> bool

Provided Methods§

Source

fn is_triple_quoted(self) -> bool

Is the string triple-quoted, i.e., does it begin and end with three consecutive quote characters?

Source

fn quote_str(self) -> &'static str

A str representation of the quotes used to start and close. This does not include any prefixes the string has in its opener.

Source

fn quote_len(self) -> TextSize

The length of the quotes used to start and close the string. This does not include the length of any prefixes the string has in its opener.

Source

fn opener_len(self) -> TextSize

The total length of the string’s opener, i.e., the length of the prefixes plus the length of the quotes used to open the string.

Source

fn closer_len(self) -> TextSize

The total length of the string’s closer. This is always equal to self.quote_len(), except when the string is unclosed, in which case the length is zero.

Source

fn as_any_string_flags(self) -> AnyStringFlags

Source

fn display_contents(self, contents: &str) -> DisplayFlags<'_>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§