Struct str_stack::StrStack [] [src]

pub struct StrStack { /* fields omitted */ }

Methods

impl StrStack
[src]

[src]

Create a new StrStack.

[src]

Create a new StrStack with the given capacity.

You will be able to push bytes bytes and create strings strings before reallocating.

[src]

Push a string onto the string stack.

This returns the index of the string on the stack.

Important traits for Iter<'a>
[src]

Iterate over the strings on the stack.

[src]

Remove the top string from the stack.

Returns true iff a string was removed.

[src]

Clear the stack.

[src]

Returns the number of strings on the stack.

[src]

Truncate the stack to len strings.

[src]

Read from source into the string stack.

Returns the index of the new string or an IO Error.

[src]

Returns a writer helper for this string stack.

This is useful for building a string in-place on the string-stack.

Example:

use std::fmt::Write;
use str_stack::StrStack;

let mut s = StrStack::new();
let index = {
    let mut writer = s.writer();
    writer.write_str("Hello");
    writer.write_char(' ');
    writer.write_str("World");
    writer.write_char('!');
    writer.finish()
};
assert_eq!(&s[index], "Hello World!");

[src]

Allows calling the write! macro directly on the string stack:

Example:

use std::fmt::Write;
use str_stack::StrStack;

let mut s = StrStack::new();
let index = write!(&mut s, "Hello {}!", "World");
assert_eq!(&s[index], "Hello World!");

[src]

Trait Implementations

impl Clone for StrStack
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for StrStack
[src]

[src]

Returns the "default value" for a type. Read more

impl Index<usize> for StrStack
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl Debug for StrStack
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a> IntoIterator for &'a StrStack
[src]

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Important traits for Iter<'a>
[src]

Creates an iterator from a value. Read more

impl<S> Extend<S> for StrStack where
    S: AsRef<str>, 
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl<S> FromIterator<S> for StrStack where
    S: AsRef<str>, 
[src]

[src]

Creates a value from an iterator. Read more

Auto Trait Implementations

impl Send for StrStack

impl Sync for StrStack