[][src]Struct fastobo::ast::QuotedString

pub struct QuotedString { /* fields omitted */ }

A string enclosed by quotes, used for definitions.

This type is mostly just a wrapper for String that patches FromStr and Display so that it can read and write quoted strings in OBO documents.

Usage

Use FromStr to parse the serialized representation of a QuotedString, and QuotedString::new to create a quoted string with its content set from an Into<String> implementor.

To get the the unescaped String, use QuotedString::into_string, or use ToString::to_string to obtained a serialized (escaped) version of the quoted string.

Example

let s = QuotedString::new("Hello, world!");
assert_eq!(s.as_str(), "Hello, world!");
assert_eq!(s.to_string(), "\"Hello, world!\"");

Methods

impl QuotedString[src]

pub fn new<S>(s: S) -> Self where
    S: Into<String>, 
[src]

Create a new QuotedString from an unescaped string.

pub fn as_str(&self) -> &str[src]

Extracts a string slice containing the QuotedString value.

pub fn into_string(self) -> String[src]

Retrieve the underlying unescaped string from the QuotedString.

Methods from Deref<Target = QuotedStr>

Trait Implementations

impl<'i> FromPair<'i> for QuotedString[src]

fn from_pair(pair: Pair<'i, Rule>) -> Result<Self, SyntaxError>[src]

Create a new instance from a Pair.

impl<'a> Share<'a, &'a QuotedStr> for QuotedString[src]

impl From<String> for QuotedString[src]

impl<'_> From<&'_ str> for QuotedString[src]

impl PartialEq<QuotedString> for QuotedString[src]

impl PartialEq<str> for QuotedString[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<String> for QuotedString[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Clone for QuotedString[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl AsRef<String> for QuotedString[src]

impl AsRef<QuotedString> for QuotedString[src]

impl AsRef<str> for QuotedString[src]

impl AsRef<QuotedStr> for QuotedString[src]

impl PartialOrd<QuotedString> for QuotedString[src]

impl Eq for QuotedString[src]

impl Into<String> for QuotedString[src]

impl Ord for QuotedString[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl Deref for QuotedString[src]

type Target = QuotedStr

The resulting type after dereferencing.

impl Display for QuotedString[src]

impl Debug for QuotedString[src]

impl FromStr for QuotedString[src]

type Err = SyntaxError

The associated error which can be returned from parsing.

impl Hash for QuotedString[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Borrow<QuotedStr> for QuotedString[src]

impl OpaqueTypedef for QuotedString[src]

type Inner = String

Inner type.

type Error = Infallible

Validation error type.

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]