From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- regex_syntax/enum.ErrorKind.html | 190 ++++++++++++++ regex_syntax/enum.Expr.html | 181 +++++++++++++ regex_syntax/enum.Repeater.html | 127 +++++++++ regex_syntax/fn.quote.html | 105 ++++++++ regex_syntax/index.html | 223 ++++++++++++++++ regex_syntax/parser/index.html | 0 regex_syntax/parser/sidebar-items.js | 1 + regex_syntax/sidebar-items.js | 1 + regex_syntax/struct.CharClass.html | 493 +++++++++++++++++++++++++++++++++++ regex_syntax/struct.ClassRange.html | 140 ++++++++++ regex_syntax/struct.Error.html | 123 +++++++++ regex_syntax/type.Result.html | 102 ++++++++ 12 files changed, 1686 insertions(+) create mode 100644 regex_syntax/enum.ErrorKind.html create mode 100644 regex_syntax/enum.Expr.html create mode 100644 regex_syntax/enum.Repeater.html create mode 100644 regex_syntax/fn.quote.html create mode 100644 regex_syntax/index.html create mode 100644 regex_syntax/parser/index.html create mode 100644 regex_syntax/parser/sidebar-items.js create mode 100644 regex_syntax/sidebar-items.js create mode 100644 regex_syntax/struct.CharClass.html create mode 100644 regex_syntax/struct.ClassRange.html create mode 100644 regex_syntax/struct.Error.html create mode 100644 regex_syntax/type.Result.html (limited to 'regex_syntax') diff --git a/regex_syntax/enum.ErrorKind.html b/regex_syntax/enum.ErrorKind.html new file mode 100644 index 0000000..b7074a5 --- /dev/null +++ b/regex_syntax/enum.ErrorKind.html @@ -0,0 +1,190 @@ + + + + + + + + + + regex_syntax::ErrorKind - Rust + + + + + + + + + + + + + + + +
+

Enum regex_syntax::ErrorKind + + [] + + [src]

+
pub enum ErrorKind {
+    DoubleFlagNegation,
+    DuplicateCaptureName(String),
+    EmptyAlternate,
+    EmptyCaptureName,
+    EmptyFlagNegation,
+    EmptyGroup,
+    InvalidBase10(String),
+    InvalidBase16(String),
+    InvalidCaptureName(String),
+    InvalidClassRange {
+        start: char,
+        end: char,
+    },
+    InvalidClassEscape(Expr),
+    InvalidRepeatRange {
+        min: u32,
+        max: u32,
+    },
+    InvalidScalarValue(u32),
+    MissingBase10,
+    RepeaterExpectsExpr,
+    RepeaterUnexpectedExpr(Expr),
+    UnclosedCaptureName(String),
+    UnclosedHex,
+    UnclosedParen,
+    UnclosedRepeat,
+    UnclosedUnicodeName,
+    UnexpectedClassEof,
+    UnexpectedEscapeEof,
+    UnexpectedFlagEof,
+    UnexpectedTwoDigitHexEof,
+    UnopenedParen,
+    UnrecognizedEscape(char),
+    UnrecognizedFlag(char),
+    UnrecognizedUnicodeClass(String),
+    // some variants omitted
+}

The specific type of parse error that can occur.

+

Variants

+
DoubleFlagNegation

A negation symbol is used twice in flag settings. +e.g., (?-i-s).

+
DuplicateCaptureName

The same capture name was used more than once. +e.g., (?P<a>.)(?P<a>.).

+
EmptyAlternate

An alternate is empty. e.g., (|a).

+
EmptyCaptureName

A capture group name is empty. e.g., (?P<>a).

+
EmptyFlagNegation

A negation symbol was not proceded by any flags. e.g., (?i-).

+
EmptyGroup

A group is empty. e.g., ().

+
InvalidBase10

An invalid number was used in a counted repetition. e.g., a{b}.

+
InvalidBase16

An invalid hexadecimal number was used in an escape sequence. +e.g., \xAG.

+
InvalidCaptureName

An invalid capture name was used. e.g., (?P<0a>b).

+
InvalidClassRange

An invalid class range was givien. Specifically, when the start of the +range is greater than the end. e.g., [z-a].

+

Fields

+ +
start

The first character specified in the range.

+
end

The second character specified in the range.

+
InvalidClassEscape

An escape sequence was used in a character class where it is not +allowed. e.g., [a-\pN] or [\A].

+
InvalidRepeatRange

An invalid counted repetition min/max was given. e.g., a{2,1}.

+

Fields

+ +
min

The first number specified in the repetition.

+
max

The second number specified in the repetition.

+
InvalidScalarValue

An invalid Unicode scalar value was used in a long hexadecimal +sequence. e.g., \x{D800}.

+
MissingBase10

An empty counted repetition operator. e.g., a{}.

+
RepeaterExpectsExpr

A repetition operator was not applied to an expression. e.g., *.

+
RepeaterUnexpectedExpr

A repetition operator was applied to an expression that cannot be +repeated. e.g., a+* or a|*.

+
UnclosedCaptureName

A capture group name that is never closed. e.g., (?P<a.

+
UnclosedHex

An unclosed hexadecimal literal. e.g., \x{a.

+
UnclosedParen

An unclosed parenthesis. e.g., (a.

+
UnclosedRepeat

An unclosed counted repetition operator. e.g., a{2.

+
UnclosedUnicodeName

An unclosed named Unicode class. e.g., \p{Yi.

+
UnexpectedClassEof

Saw end of regex before class was closed. e.g., [a.

+
UnexpectedEscapeEof

Saw end of regex before escape sequence was closed. e.g., \.

+
UnexpectedFlagEof

Saw end of regex before flags were closed. e.g., (?i.

+
UnexpectedTwoDigitHexEof

Saw end of regex before two hexadecimal digits were seen. e.g., \xA.

+
UnopenedParen

Unopened parenthesis. e.g., ).

+
UnrecognizedEscape

Unrecognized escape sequence. e.g., \q.

+
UnrecognizedFlag

Unrecognized flag. e.g., (?a).

+
UnrecognizedUnicodeClass

Unrecognized named Unicode class. e.g., \p{Foo}.

+

Trait Implementations

impl Display for ErrorKind

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl PartialEq for ErrorKind

fn eq(&self, __arg_0: &ErrorKind) -> bool

+

fn ne(&self, __arg_0: &ErrorKind) -> bool

+

impl Debug for ErrorKind

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for ErrorKind

fn clone(&self) -> ErrorKind

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/enum.Expr.html b/regex_syntax/enum.Expr.html new file mode 100644 index 0000000..c461971 --- /dev/null +++ b/regex_syntax/enum.Expr.html @@ -0,0 +1,181 @@ + + + + + + + + + + regex_syntax::Expr - Rust + + + + + + + + + + + + + + + +
+

Enum regex_syntax::Expr + + [] + + [src]

+
pub enum Expr {
+    Empty,
+    Literal {
+        chars: Vec<char>,
+        casei: bool,
+    },
+    AnyChar,
+    AnyCharNoNL,
+    Class(CharClass),
+    StartLine,
+    EndLine,
+    StartText,
+    EndText,
+    WordBoundary,
+    NotWordBoundary,
+    Group {
+        e: Box<Expr>,
+        i: Option<usize>,
+        name: Option<String>,
+    },
+    Repeat {
+        e: Box<Expr>,
+        r: Repeater,
+        greedy: bool,
+    },
+    Concat(Vec<Expr>),
+    Alternate(Vec<Expr>),
+}

A regular expression abstract syntax tree.

+ +

An Expr represents the abstract syntax of a regular expression.

+

Variants

+
Empty

An empty regex (which never matches any text).

+
Literal

A sequence of one or more literal characters to be matched.

+

Fields

+ +
chars

The characters.

+
casei

Whether to match case insensitively.

+
AnyChar

Match any character, excluding new line.

+
AnyCharNoNL

Match any character.

+
Class

A character class.

+
StartLine

Match the start of a line or beginning of input.

+
EndLine

Match the end of a line or end of input.

+
StartText

Match the beginning of input.

+
EndText

Match the end of input.

+
WordBoundary

Match a word boundary (word character on one side and a non-word +character on the other).

+
NotWordBoundary

Match a position that is not a word boundary (word or non-word +characters on both sides).

+
Group

A group, possibly non-capturing.

+

Fields

+ +
e

The expression inside the group.

+
i

The capture index (starting at 1) only for capturing groups.

+
name

The capture name, only for capturing named groups.

+
Repeat

A repeat operator (?, *, + or {m,n}).

+

Fields

+ +
e

The expression to be repeated. Limited to literals, ., classes +or grouped expressions.

+
r

The type of repeat operator used.

+
greedy

Whether the repeat is greedy (match the most) or not (match the +least).

+
Concat

A concatenation of expressions. Must be matched one after the other.

+ +

N.B. A concat expression can only appear at the top-level or +immediately inside a group expression.

+
Alternate

An alternation of expressions. Only one must match.

+ +

N.B. An alternate expression can only appear at the top-level or +immediately inside a group expression.

+

Methods

impl Expr

fn parse(s: &str) -> Result<Expr>

+

Parses a string in a regular expression syntax tree.

+

Trait Implementations

impl Display for Expr

This implementation of Display will write a regular expression from the +syntax tree. It does not write the original string parsed.

+

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl Eq for Expr

impl PartialEq for Expr

fn eq(&self, __arg_0: &Expr) -> bool

+

fn ne(&self, __arg_0: &Expr) -> bool

+

impl Debug for Expr

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for Expr

fn clone(&self) -> Expr

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/enum.Repeater.html b/regex_syntax/enum.Repeater.html new file mode 100644 index 0000000..2ed4b45 --- /dev/null +++ b/regex_syntax/enum.Repeater.html @@ -0,0 +1,127 @@ + + + + + + + + + + regex_syntax::Repeater - Rust + + + + + + + + + + + + + + + +
+

Enum regex_syntax::Repeater + + [] + + [src]

+
pub enum Repeater {
+    ZeroOrOne,
+    ZeroOrMore,
+    OneOrMore,
+    Range {
+        min: u32,
+        max: Option<u32>,
+    },
+}

The type of a repeat operator expression.

+

Variants

+
ZeroOrOne

Match zero or one (?).

+
ZeroOrMore

Match zero or more (*).

+
OneOrMore

Match one or more (+).

+
Range

Match for at least min and at most max ({m,n}).

+ +

When max is None, there is no upper bound on the number of matches.

+

Fields

+ +
min

Lower bound on the number of matches.

+
max

Optional upper bound on the number of matches.

+

Trait Implementations

impl Display for Repeater

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl Eq for Repeater

impl PartialEq for Repeater

fn eq(&self, __arg_0: &Repeater) -> bool

+

fn ne(&self, __arg_0: &Repeater) -> bool

+

impl Debug for Repeater

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Copy for Repeater

impl Clone for Repeater

fn clone(&self) -> Repeater

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/fn.quote.html b/regex_syntax/fn.quote.html new file mode 100644 index 0000000..e753698 --- /dev/null +++ b/regex_syntax/fn.quote.html @@ -0,0 +1,105 @@ + + + + + + + + + + regex_syntax::quote - Rust + + + + + + + + + + + + + + + +
+

Function regex_syntax::quote + + [] + + [src]

+
pub fn quote(text: &str) -> String

Escapes all regular expression meta characters in text.

+ +

The string returned may be safely used as a literal in a regular +expression.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/index.html b/regex_syntax/index.html new file mode 100644 index 0000000..2c4ad5c --- /dev/null +++ b/regex_syntax/index.html @@ -0,0 +1,223 @@ + + + + + + + + + + regex_syntax - Rust + + + + + + + + + + + + + + + +
+

Crate regex_syntax + + [] + + [src]

+

This crate provides a regular expression parser and an abstract syntax for +regular expressions. The abstract syntax is defined by the Expr type. The +concrete syntax is enumerated in the +regex +crate documentation.

+ +

Note that since this crate is first and foremost an implementation detail for +the regex crate, it may experience more frequent breaking changes. It is +exposed as a separate crate so that others may use it to do analysis on regular +expressions or even build their own matching engine.

+ +

Example: parsing an expression

+

Parsing a regular expression can be done with the Expr::parse function.

+
+use regex_syntax::Expr;
+
+assert_eq!(Expr::parse(r"ab|yz").unwrap(), Expr::Alternate(vec![
+    Expr::Literal { chars: vec!['a', 'b'], casei: false },
+    Expr::Literal { chars: vec!['y', 'z'], casei: false },
+]));
+
+ +

Example: inspecting an error

+

The parser in this crate provides very detailed error values. For example, +if an invalid character class range is given:

+
+use regex_syntax::{Expr, ErrorKind};
+
+let err = Expr::parse(r"[z-a]").unwrap_err();
+assert_eq!(err.position(), 4);
+assert_eq!(err.kind(), &ErrorKind::InvalidClassRange {
+    start: 'z',
+    end: 'a',
+});
+
+ +

Or unbalanced parentheses:

+
+use regex_syntax::{Expr, ErrorKind};
+
+let err = Expr::parse(r"ab(cd").unwrap_err();
+assert_eq!(err.position(), 2);
+assert_eq!(err.kind(), &ErrorKind::UnclosedParen);
+
+

Structs

+ + + + + + + + + + + + + + + +
CharClass +

A character class.

+ +
ClassRange +

A single inclusive range in a character class.

+ +
Error +

A parse error.

+ +

Enums

+ + + + + + + + + + + + + + + +
ErrorKind +

The specific type of parse error that can occur.

+ +
Expr +

A regular expression abstract syntax tree.

+ +
Repeater +

The type of a repeat operator expression.

+ +

Functions

+ + + + + +
quote +

Escapes all regular expression meta characters in text.

+ +

Type Definitions

+ + + + + +
Result +

An alias for computations that can return a Error.

+ +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/parser/index.html b/regex_syntax/parser/index.html new file mode 100644 index 0000000..e69de29 diff --git a/regex_syntax/parser/sidebar-items.js b/regex_syntax/parser/sidebar-items.js new file mode 100644 index 0000000..48333d3 --- /dev/null +++ b/regex_syntax/parser/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/regex_syntax/sidebar-items.js b/regex_syntax/sidebar-items.js new file mode 100644 index 0000000..7f23766 --- /dev/null +++ b/regex_syntax/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["ErrorKind","The specific type of parse error that can occur."],["Expr","A regular expression abstract syntax tree."],["Repeater","The type of a repeat operator expression."]],"fn":[["quote","Escapes all regular expression meta characters in `text`."]],"struct":[["CharClass","A character class."],["ClassRange","A single inclusive range in a character class."],["Error","A parse error."]],"type":[["Result","An alias for computations that can return a `Error`."]]}); \ No newline at end of file diff --git a/regex_syntax/struct.CharClass.html b/regex_syntax/struct.CharClass.html new file mode 100644 index 0000000..9e6ebfc --- /dev/null +++ b/regex_syntax/struct.CharClass.html @@ -0,0 +1,493 @@ + + + + + + + + + + regex_syntax::CharClass - Rust + + + + + + + + + + + + + + + +
+

Struct regex_syntax::CharClass + + [] + + [src]

+
pub struct CharClass {
+    // some fields omitted
+}

A character class.

+ +

A character class has a canonical format that the parser guarantees. Its +canonical format is defined by the following invariants:

+ +
    +
  1. Given any Unicode scalar value, it is matched by at most one character +range in a canonical character class.
  2. +
  3. Every adjacent character range is separated by at least one Unicode +scalar value.
  4. +
  5. Given any pair of character ranges r1 and r2, if +r1.end < r2.start, then r1 comes before r2 in a canonical +character class.
  6. +
+ +

In sum, any CharClass produced by this crate's parser is a sorted +sequence of non-overlapping ranges. This makes it possible to test whether +a character is matched by a class with a binary search.

+ +

Additionally, a character class may be marked case insensitive. If it's +case insensitive, then:

+ +
    +
  1. Simple case folding has been applied to all ranges.
  2. +
  3. Simple case folding must be applied to a character before testing +whether it matches the character class.
  4. +
+

Methods

impl CharClass

fn matches(&self, c: char) -> bool

+

Returns true if c is matched by this character class.

+ +

If this character class is case insensitive, then simple case folding +is applied to c before checking for a match.

+

fn is_case_insensitive(&self) -> bool

+

Returns true if this character class should be matched case +insensitively.

+ +

When true, simple case folding has already been applied to the +class.

+

Methods from Deref<Target=Vec<ClassRange>>

fn capacity(&self) -> usize

+

Returns the number of elements the vector can hold without +reallocating.

+ +

Examples

+let vec: Vec<i32> = Vec::with_capacity(10);
+assert_eq!(vec.capacity(), 10);
+
+

fn reserve(&mut self, additional: usize)

+

Reserves capacity for at least additional more elements to be inserted +in the given Vec<T>. The collection may reserve more space to avoid +frequent reallocations.

+ +

Panics

+

Panics if the new capacity overflows usize.

+ +

Examples

+let mut vec = vec![1];
+vec.reserve(10);
+assert!(vec.capacity() >= 11);
+
+

fn reserve_exact(&mut self, additional: usize)

+

Reserves the minimum capacity for exactly additional more elements to +be inserted in the given Vec<T>. Does nothing if the capacity is already +sufficient.

+ +

Note that the allocator may give the collection more space than it +requests. Therefore capacity can not be relied upon to be precisely +minimal. Prefer reserve if future insertions are expected.

+ +

Panics

+

Panics if the new capacity overflows usize.

+ +

Examples

+let mut vec = vec![1];
+vec.reserve_exact(10);
+assert!(vec.capacity() >= 11);
+
+

fn shrink_to_fit(&mut self)

+

Shrinks the capacity of the vector as much as possible.

+ +

It will drop down as close as possible to the length but the allocator +may still inform the vector that there is space for a few more elements.

+ +

Examples

+let mut vec = Vec::with_capacity(10);
+vec.extend([1, 2, 3].iter().cloned());
+assert_eq!(vec.capacity(), 10);
+vec.shrink_to_fit();
+assert!(vec.capacity() >= 3);
+
+

fn into_boxed_slice(self) -> Box<[T]>

+

Converts the vector into Box<[T]>.

+ +

Note that this will drop any excess capacity. Calling this and +converting back to a vector with into_vec() is equivalent to calling +shrink_to_fit().

+

fn truncate(&mut self, len: usize)

+

Shorten a vector, dropping excess elements.

+ +

If len is greater than the vector's current length, this has no +effect.

+ +

Examples

+let mut vec = vec![1, 2, 3, 4];
+vec.truncate(2);
+assert_eq!(vec, [1, 2]);
+
+

fn as_slice(&self) -> &[T]

+
Unstable

: waiting on RFC revision

+

Extracts a slice containing the entire vector.

+ +

Equivalent to &s[..].

+

fn as_mut_slice(&mut self) -> &mut [T]

+
Unstable

: waiting on RFC revision

+

Extracts a mutable slice of the entire vector.

+ +

Equivalent to &mut s[..].

+

unsafe fn set_len(&mut self, len: usize)

+

Sets the length of a vector.

+ +

This will explicitly set the size of the vector, without actually +modifying its buffers, so it is up to the caller to ensure that the +vector is actually the specified size.

+ +

Examples

+let mut v = vec![1, 2, 3, 4];
+unsafe {
+    v.set_len(1);
+}
+
+

fn swap_remove(&mut self, index: usize) -> T

+

Removes an element from anywhere in the vector and return it, replacing +it with the last element.

+ +

This does not preserve ordering, but is O(1).

+ +

Panics

+

Panics if index is out of bounds.

+ +

Examples

+let mut v = vec!["foo", "bar", "baz", "qux"];
+
+assert_eq!(v.swap_remove(1), "bar");
+assert_eq!(v, ["foo", "qux", "baz"]);
+
+assert_eq!(v.swap_remove(0), "foo");
+assert_eq!(v, ["baz", "qux"]);
+
+

fn insert(&mut self, index: usize, element: T)

+

Inserts an element at position index within the vector, shifting all +elements after position i one position to the right.

+ +

Panics

+

Panics if index is greater than the vector's length.

+ +

Examples

+let mut vec = vec![1, 2, 3];
+vec.insert(1, 4);
+assert_eq!(vec, [1, 4, 2, 3]);
+vec.insert(4, 5);
+assert_eq!(vec, [1, 4, 2, 3, 5]);
+
+

fn remove(&mut self, index: usize) -> T

+

Removes and returns the element at position index within the vector, +shifting all elements after position index one position to the left.

+ +

Panics

+

Panics if index is out of bounds.

+ +

Examples

+let mut v = vec![1, 2, 3];
+assert_eq!(v.remove(1), 2);
+assert_eq!(v, [1, 3]);
+
+

fn retain<F>(&mut self, f: F) where F: FnMut(&T) -> bool

+

Retains only the elements specified by the predicate.

+ +

In other words, remove all elements e such that f(&e) returns false. +This method operates in place and preserves the order of the retained +elements.

+ +

Examples

+let mut vec = vec![1, 2, 3, 4];
+vec.retain(|&x| x%2 == 0);
+assert_eq!(vec, [2, 4]);
+
+

fn push(&mut self, value: T)

+

Appends an element to the back of a collection.

+ +

Panics

+

Panics if the number of elements in the vector overflows a usize.

+ +

Examples

+let mut vec = vec!(1, 2);
+vec.push(3);
+assert_eq!(vec, [1, 2, 3]);
+
+

fn pop(&mut self) -> Option<T>

+

Removes the last element from a vector and returns it, or None if it is empty.

+ +

Examples

+let mut vec = vec![1, 2, 3];
+assert_eq!(vec.pop(), Some(3));
+assert_eq!(vec, [1, 2]);
+
+

fn append(&mut self, other: &mut Vec<T>)

+
Unstable

: new API, waiting for dust to settle

+

Moves all the elements of other into Self, leaving other empty.

+ +

Panics

+

Panics if the number of elements in the vector overflows a usize.

+ +

Examples

+let mut vec = vec![1, 2, 3];
+let mut vec2 = vec![4, 5, 6];
+vec.append(&mut vec2);
+assert_eq!(vec, [1, 2, 3, 4, 5, 6]);
+assert_eq!(vec2, []);
+
+

fn drain<R>(&mut self, range: R) -> Drain<T> where R: RangeArgument<usize>

+
Unstable

: recently added, matches RFC

+

Create a draining iterator that removes the specified range in the vector +and yields the removed items from start to end. The element range is +removed even if the iterator is not consumed until the end.

+ +

Note: It is unspecified how many elements are removed from the vector, +if the Drain value is leaked.

+ +

Panics

+

Panics if the starting point is greater than the end point or if +the end point is greater than the length of the vector.

+ +

Examples

+
+// Draining using `..` clears the whole vector.
+let mut v = vec![1, 2, 3];
+let u: Vec<_> = v.drain(..).collect();
+assert_eq!(v, &[]);
+assert_eq!(u, &[1, 2, 3]);
+
+

fn clear(&mut self)

+

Clears the vector, removing all values.

+ +

Examples

+let mut v = vec![1, 2, 3];
+
+v.clear();
+
+assert!(v.is_empty());
+
+

fn len(&self) -> usize

+

Returns the number of elements in the vector.

+ +

Examples

+let a = vec![1, 2, 3];
+assert_eq!(a.len(), 3);
+
+

fn is_empty(&self) -> bool

+

Returns true if the vector contains no elements.

+ +

Examples

+let mut v = Vec::new();
+assert!(v.is_empty());
+
+v.push(1);
+assert!(!v.is_empty());
+
+

fn map_in_place<U, F>(self, f: F) -> Vec<U> where F: FnMut(T) -> U

+
Unstable

: API may change to provide stronger guarantees

+

Converts a Vec<T> to a Vec<U> where T and U have the same +size and in case they are not zero-sized the same minimal alignment.

+ +

Panics

+

Panics if T and U have differing sizes or are not zero-sized and +have differing minimal alignments.

+ +

Examples

+let v = vec![0, 1, 2];
+let w = v.map_in_place(|i| i + 3);
+assert_eq!(&w[..], &[3, 4, 5]);
+
+#[derive(PartialEq, Debug)]
+struct Newtype(u8);
+let bytes = vec![0x11, 0x22];
+let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
+assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]);
+
+

fn split_off(&mut self, at: usize) -> Vec<T>

+
Unstable

: new API, waiting for dust to settle

+

Splits the collection into two at the given index.

+ +

Returns a newly allocated Self. self contains elements [0, at), +and the returned Self contains elements [at, len).

+ +

Note that the capacity of self does not change.

+ +

Panics

+

Panics if at > len.

+ +

Examples

+let mut vec = vec![1,2,3];
+let vec2 = vec.split_off(1);
+assert_eq!(vec, [1]);
+assert_eq!(vec2, [2, 3]);
+
+

fn resize(&mut self, new_len: usize, value: T)

+
Unstable

: matches collection reform specification; waiting for dust to settle

+

Resizes the Vec in-place so that len() is equal to new_len.

+ +

Calls either extend() or truncate() depending on whether new_len +is larger than the current value of len() or not.

+ +

Examples

+let mut vec = vec!["hello"];
+vec.resize(3, "world");
+assert_eq!(vec, ["hello", "world", "world"]);
+
+let mut vec = vec![1, 2, 3, 4];
+vec.resize(2, 0);
+assert_eq!(vec, [1, 2]);
+
+

fn push_all(&mut self, other: &[T])

+
Unstable

: likely to be replaced by a more optimized extend

+

Appends all elements in a slice to the Vec.

+ +

Iterates over the slice other, clones each element, and then appends +it to this Vec. The other vector is traversed in-order.

+ +

Examples

+let mut vec = vec![1];
+vec.push_all(&[2, 3, 4]);
+assert_eq!(vec, [1, 2, 3, 4]);
+
+

fn dedup(&mut self)

+

Removes consecutive repeated elements in the vector.

+ +

If the vector is sorted, this removes all duplicates.

+ +

Examples

+let mut vec = vec![1, 2, 2, 3, 2];
+
+vec.dedup();
+
+assert_eq!(vec, [1, 2, 3, 2]);
+
+

Trait Implementations

impl Deref for CharClass

type Target = Vec<ClassRange>

+

fn deref(&self) -> &Vec<ClassRange>

+

impl IntoIterator for CharClass

type Item = ClassRange

+

type IntoIter = IntoIter<ClassRange>

+

fn into_iter(self) -> IntoIter<ClassRange>

+

impl<'a> IntoIterator for &'a CharClass

type Item = &'a ClassRange

+

type IntoIter = Iter<'a, ClassRange>

+

fn into_iter(self) -> Iter<'a, ClassRange>

+

impl Display for CharClass

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl Eq for CharClass

impl PartialEq for CharClass

fn eq(&self, __arg_0: &CharClass) -> bool

+

fn ne(&self, __arg_0: &CharClass) -> bool

+

impl Debug for CharClass

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for CharClass

fn clone(&self) -> CharClass

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/struct.ClassRange.html b/regex_syntax/struct.ClassRange.html new file mode 100644 index 0000000..d1d34f6 --- /dev/null +++ b/regex_syntax/struct.ClassRange.html @@ -0,0 +1,140 @@ + + + + + + + + + + regex_syntax::ClassRange - Rust + + + + + + + + + + + + + + + +
+

Struct regex_syntax::ClassRange + + [] + + [src]

+
pub struct ClassRange {
+    pub start: char,
+    pub end: char,
+}

A single inclusive range in a character class.

+ +

Since range boundaries are defined by Unicode scalar values, the boundaries +can never be in the open interval (0xD7FF, 0xE000). However, a range may +cover codepoints that are not scalar values.

+ +

Note that this has a few convenient impls on PartialEq and PartialOrd +for testing whether a character is contained inside a given range.

+

Fields

+ + +
start

The start character of the range.

+ +

This must be less than or equal to end.

+
end

The end character of the range.

+ +

This must be greater than or equal to end.

+

Trait Implementations

impl PartialEq<char> for ClassRange

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

+

fn ne(&self, other: &Rhs) -> bool

+

impl PartialOrd<char> for ClassRange

fn partial_cmp(&self, other: &char) -> Option<Ordering>

+

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

+

fn le(&self, other: &Rhs) -> bool

+

fn gt(&self, other: &Rhs) -> bool

+

fn ge(&self, other: &Rhs) -> bool

+

impl Display for ClassRange

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl Ord for ClassRange

fn cmp(&self, __arg_0: &ClassRange) -> Ordering

+

impl Eq for ClassRange

impl PartialOrd for ClassRange

fn partial_cmp(&self, __arg_0: &ClassRange) -> Option<Ordering>

+

fn lt(&self, __arg_0: &ClassRange) -> bool

+

fn le(&self, __arg_0: &ClassRange) -> bool

+

fn gt(&self, __arg_0: &ClassRange) -> bool

+

fn ge(&self, __arg_0: &ClassRange) -> bool

+

impl PartialEq for ClassRange

fn eq(&self, __arg_0: &ClassRange) -> bool

+

fn ne(&self, __arg_0: &ClassRange) -> bool

+

impl Debug for ClassRange

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Copy for ClassRange

impl Clone for ClassRange

fn clone(&self) -> ClassRange

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/struct.Error.html b/regex_syntax/struct.Error.html new file mode 100644 index 0000000..3ab9c44 --- /dev/null +++ b/regex_syntax/struct.Error.html @@ -0,0 +1,123 @@ + + + + + + + + + + regex_syntax::Error - Rust + + + + + + + + + + + + + + + +
+

Struct regex_syntax::Error + + [] + + [src]

+
pub struct Error {
+    // some fields omitted
+}

A parse error.

+ +

This includes details about the specific type of error and a rough +approximation of where it occurred.

+

Methods

impl Error

fn position(&self) -> usize

+

Returns an approximate character offset at which the error occurred.

+ +

The character offset may be equal to the number of characters in the +string, in which case it should be interpreted as pointing to the end +of the regex.

+

fn kind(&self) -> &ErrorKind

+

Returns the type of the regex parse error.

+

Trait Implementations

impl Error for Error

fn description(&self) -> &str

+

fn cause(&self) -> Option<&Error>

+

impl Display for Error

fn fmt(&self, f: &mut Formatter) -> Result

+

Derived Implementations

impl PartialEq for Error

fn eq(&self, __arg_0: &Error) -> bool

+

fn ne(&self, __arg_0: &Error) -> bool

+

impl Debug for Error

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for Error

fn clone(&self) -> Error

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex_syntax/type.Result.html b/regex_syntax/type.Result.html new file mode 100644 index 0000000..ca0c192 --- /dev/null +++ b/regex_syntax/type.Result.html @@ -0,0 +1,102 @@ + + + + + + + + + + regex_syntax::Result - Rust + + + + + + + + + + + + + + + +
+

regex_syntax::Result + + [] + + [src]

+
type Result<T> = Result<T, Error>;

An alias for computations that can return a Error.

+
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3