Struct rcstring::CString [] [src]

pub struct CString<'a> { /* fields omitted */ }

Type representing a C-compatible string.

Methods

impl<'a> CString<'a>
[src]

Constructs a new CString from a string slice

The caller MUST ensure that there is a trailing NULL to terminate the string. To make this easier, the cstr! macro is provided.

CStrings MUST NOT have any non-ASCII characters, even extended ASCII characters aren't allowed.

Examples

use rcstring::CString;

let cs = CString::new("foo\0").unwrap();

Converts an exising raw pointer to a string and converts it to a CString with a length determined by an internal strlen implementation.

Returns a mutable pointer to a CString for use in functions taking a classic C string

Returns length of string, including trailing NULL

Trait Implementations

impl<'a> Eq for CString<'a>
[src]

impl<'a> PartialEq for CString<'a>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialOrd for CString<'a>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

impl<'a> Ord for CString<'a>
[src]

This method returns an Ordering between self and other. Read more