Enum std::send_str::SendStr

pub enum SendStr {
    SendStrOwned(~str),
    SendStrStatic(&'static str),
}

A SendStr is a string that can hold either a ~str or a &'static str. This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Methods

impl SendStr

fn is_owned(&self) -> bool

Returns true if this SendStr wraps an owned string

fn is_static(&self) -> bool

Returns true if this SendStr wraps an static string

Trait Implementations

impl ToStr for SendStr

fn to_str(&self) -> ~str

Converts the value of self to an owned string

impl Eq for SendStr

fn eq(&self, other: &SendStr) -> bool

impl TotalEq for SendStr

fn equals(&self, other: &SendStr) -> bool

impl Ord for SendStr

fn lt(&self, other: &SendStr) -> bool

impl TotalOrd for SendStr

fn cmp(&self, other: &SendStr) -> Ordering

impl<'self, S: Str> Equiv<S> for SendStr

fn equiv(&self, other: &S) -> bool

impl Str for SendStr

fn as_slice<'r>(&'r self) -> &'r str

Work with self as a slice.

fn into_owned(self) -> ~str

Convert self into a ~str, not making a copy if possible

impl Container for SendStr

fn len(&self) -> uint

Return the number of elements in the container

impl Clone for SendStr

fn clone(&self) -> SendStr

Returns a copy of the value. The contents of owned pointers are copied to maintain uniqueness, while the contents of managed pointers are not copied.

impl DeepClone for SendStr

fn deep_clone(&self) -> SendStr

Return a deep copy of the value. Unlike Clone, the contents of shared pointer types are copied.

impl Default for SendStr

fn default() -> SendStr

Return the "default value" for a type.

impl IterBytes for SendStr

fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool

Call the provided callback f one or more times with byte-slices that should be used when computing a hash value or otherwise "flattening" the structure into a sequence of bytes. The lsb0 parameter conveys whether the caller is asking for little-endian bytes (true) or big-endian (false); this should only be relevant in implementations that represent a single multi-byte datum such as a 32 bit integer or 64 bit floating-point value. It can be safely ignored for larger structured types as they are usually processed left-to-right in declaration order, regardless of underlying memory endianness.