Struct objc_encode::parse::StrEncoding
[−]
[src]
pub struct StrEncoding<S: ?Sized = str>(_)
where
S: AsRef<str>;
An Objective-C type encoding parsed from its string representation.
Encodings are parsed lazily; for example, when comparing for equality we may then find that the encoding is of a struct, but no further evaluation is done of the fields of the struct until they are requested.
Methods
impl StrEncoding
[src]
fn from_str(s: &str) -> Result<&StrEncoding, ParseEncodingError<&str>>
Constructs a StrEncoding
parsed from the given string, or returns an
error if the string was not a valid encoding.
from_str
will return a reference to a dynamically-sized StrEncoding
which is valid for the lifetime of the given string. To construct a sized
StrEncoding
that owns a buffer, use the new
method.
fn from_str_unchecked(s: &str) -> &StrEncoding
Constructs a StrEncoding
without checking to see if the given string is
a valid encoding.
If the given string is not a valid encoding, the returned StrEncoding
will panic later when being evaluated.
impl<S> StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
fn new(s: S) -> Result<StrEncoding<S>, ParseEncodingError<S>>
Constructs a StrEncoding
parsed from the given string, or returns an
error if the string was not a valid encoding.
new
constructs a sized StrEncoding
that owns the given buffer, meaning
it can be moved without dealing with lifetimes. If you only have a borrowed
&str
slice or don't want to allocate a buffer, use the from_str
method.
fn new_unchecked(s: S) -> StrEncoding<S>
Constructs a StrEncoding
without checking to see if the given string is
a valid encoding.
If the given string is not a valid encoding, the returned StrEncoding
will panic later when being evaluated.
impl<S: ?Sized> StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Trait Implementations
impl<S: Clone + ?Sized> Clone for StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
fn clone(&self) -> StrEncoding<S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<S: Copy + ?Sized> Copy for StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
impl<S: Debug + ?Sized> Debug for StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
impl<S: ?Sized> Encoding for StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
type PointerTarget = StrEncoding
The type of Encoding
that Self will use if it is an encoding for a pointer to describe its target. Read more
type ArrayItem = StrEncoding
The type of Encoding
that Self will use if it is an encoding for an array to describe its items. Read more
type StructFields = StrEncodings
The type of Encodings
that Self will use if it is an encoding for a struct to describe its fields. Read more
type UnionMembers = StrEncodings
The type of Encodings
that Self will use if it is an encoding for a union to describe its members. Read more
fn descriptor(
&self
) -> Descriptor<StrEncoding, StrEncoding, StrEncodings, StrEncodings>
&self
) -> Descriptor<StrEncoding, StrEncoding, StrEncodings, StrEncodings>
Returns a Descriptor
that describes what kind of encoding self is.
fn write<W: Write>(&self, writer: &mut W) -> Result
Writes the string representation of self to the given writer.
fn eq_encoding<T: ?Sized + Encoding>(&self, other: &T) -> bool
Returns whether self is equal to the given Encoding
.
impl<S: ?Sized> Display for StrEncoding<S> where
S: AsRef<str>,
[src]
S: AsRef<str>,
fn fmt(&self, formatter: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<S: ?Sized, E: ?Sized> PartialEq<E> for StrEncoding<S> where
S: AsRef<str>,
E: Encoding,
[src]
S: AsRef<str>,
E: Encoding,