[−][src]Struct fastobo::ast::UnquotedString
A string without delimiters, used as values in different clauses.
This type is mostly just a wrapper for String
that patches FromStr
and
Display
so that it can read and write unquoted strings in OBO documents.
Usage
Use FromStr
to parse the serialized representation of a UnquotedString
,
and UnquotedString::new
to create a quoted string with its content set
from a Rust String
passed as argument.
To get the the unescaped String
, use UnquotedString::into_string
, or
use ToString::to_string
to obtained a serialized (escaped) version of
the unquoted string.
Example
let s = UnquotedString::new("Hello, world!"); assert_eq!(s.to_string(), "Hello, world\\!");
Methods
impl UnquotedString
[src]
pub fn new<S>(s: S) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Create a new UnquotedString
from an unescaped string.
pub fn as_str(&self) -> &str
[src]
Extracts a string slice containing the UnquotedString
value.
pub fn into_string(self) -> String
[src]
Retrieve the underlying unescaped string from the UnquotedString
.
Methods from Deref<Target = UnquotedStr>
Trait Implementations
impl<'i> FromPair<'i> for UnquotedString
[src]
const RULE: Rule
[src]
unsafe fn from_pair_unchecked(pair: Pair<'i, Rule>) -> Result<Self, SyntaxError>
[src]
fn from_pair(pair: Pair<'i, Rule>) -> Result<Self, SyntaxError>
[src]
Create a new instance from a Pair
.
impl<'a> Share<'a, &'a UnquotedStr> for UnquotedString
[src]
fn share(&'a self) -> &'a UnquotedStr
[src]
impl Clone for UnquotedString
[src]
fn clone(&self) -> UnquotedString
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for UnquotedString
[src]
fn cmp(&self, other: &UnquotedString) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl AsRef<String> for UnquotedString
[src]
impl AsRef<UnquotedString> for UnquotedString
[src]
fn as_ref(&self) -> &UnquotedString
[src]
impl AsRef<str> for UnquotedString
[src]
impl AsRef<UnquotedStr> for UnquotedString
[src]
fn as_ref(&self) -> &UnquotedStr
[src]
impl From<String> for UnquotedString
[src]
impl<'_> From<&'_ str> for UnquotedString
[src]
impl PartialOrd<UnquotedString> for UnquotedString
[src]
fn partial_cmp(&self, other: &UnquotedString) -> Option<Ordering>
[src]
fn lt(&self, other: &UnquotedString) -> bool
[src]
fn le(&self, other: &UnquotedString) -> bool
[src]
fn gt(&self, other: &UnquotedString) -> bool
[src]
fn ge(&self, other: &UnquotedString) -> bool
[src]
impl Into<String> for UnquotedString
[src]
impl PartialEq<UnquotedString> for UnquotedString
[src]
fn eq(&self, other: &UnquotedString) -> bool
[src]
fn ne(&self, other: &UnquotedString) -> bool
[src]
impl Eq for UnquotedString
[src]
impl Display for UnquotedString
[src]
impl Debug for UnquotedString
[src]
impl Deref for UnquotedString
[src]
type Target = UnquotedStr
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl Hash for UnquotedString
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl FromStr for UnquotedString
[src]
type Err = SyntaxError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Borrow<UnquotedStr> for UnquotedString
[src]
fn borrow(&self) -> &UnquotedStr
[src]
impl OpaqueTypedef for UnquotedString
[src]
type Inner = String
Inner type.
type Error = Infallible
Validation error type.
unsafe fn from_inner_unchecked(__inner: Self::Inner) -> Self
[src]
fn try_from_inner(__inner: Self::Inner) -> Result<Self, Self::Error>
[src]
fn from_inner(__inner: Self::Inner) -> Self
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
unsafe fn as_inner_mut(&mut self) -> &mut Self::Inner
[src]
Auto Trait Implementations
impl Sync for UnquotedString
impl Send for UnquotedString
impl Unpin for UnquotedString
impl RefUnwindSafe for UnquotedString
impl UnwindSafe for UnquotedString
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,