diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fab614..76d6235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ SPDX-License-Identifier: MIT ## Unreleased - Add `o` command for opening a documentation item to the tui viewer. -- Add tests for Rust 1.48.0. +- Add tests for Rust 1.48.0 and 1.49.0. ## v0.4.1 (2020-10-11) diff --git a/tests/html/1.49.0/anyhow/all.html b/tests/html/1.49.0/anyhow/all.html new file mode 100644 index 0000000..45c3c6c --- /dev/null +++ b/tests/html/1.49.0/anyhow/all.html @@ -0,0 +1,6 @@ +List of all items in this crate + +

[] + + List of all items

Structs

Traits

Macros

Typedefs

\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/index.html b/tests/html/1.49.0/anyhow/index.html new file mode 100644 index 0000000..a716c43 --- /dev/null +++ b/tests/html/1.49.0/anyhow/index.html @@ -0,0 +1,127 @@ +anyhow - Rust + +

[][src]Crate anyhow

githubcrates-iodocs-rs

+
+

This library provides anyhow::Error, a trait object based error +type for easy idiomatic error handling in Rust applications.

+
+

Details

+ +
+

No-std support

+

In no_std mode, the same API is almost all available and works the same way. +To depend on Anyhow in no_std mode, disable our default enabled "std" +feature in Cargo.toml. A global allocator is required.

+
[dependencies]
+anyhow = { version = "1.0", default-features = false }
+
+

Since the ?-based error conversions would normally rely on the +std::error::Error trait which is only available through std, no_std mode +will require an explicit .map_err(Error::msg) when working with a +non-Anyhow error type inside a function that returns Anyhow's error type.

+

Re-exports

+
pub use anyhow as format_err;

Macros

+
anyhow

Construct an ad-hoc error from a string.

+
bail

Return early with an error.

+
ensure

Return early with an error if a condition is not satisfied.

+

Structs

+
Chain

Iterator of a chain of source errors.

+
Error

The Error type, a wrapper around a dynamic error type.

+

Traits

+
Context

Provides the context method for Result.

+

Type Definitions

+
Result

Result<T, Error>

+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.anyhow!.html b/tests/html/1.49.0/anyhow/macro.anyhow!.html new file mode 100644 index 0000000..72f4776 --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.anyhow!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.anyhow.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.anyhow.html b/tests/html/1.49.0/anyhow/macro.anyhow.html new file mode 100644 index 0000000..5e02104 --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.anyhow.html @@ -0,0 +1,25 @@ +anyhow::anyhow - Rust + +

[][src]Macro anyhow::anyhow

+macro_rules! anyhow {
+    ($msg:literal $(,)?) => { ... };
+    ($err:expr $(,)?) => { ... };
+    ($fmt:expr, $($arg:tt)*) => { ... };
+}
+

Construct an ad-hoc error from a string.

+

This evaluates to an Error. It can take either just a string, or a format +string with arguments. It also can take any custom type which implements +Debug and Display.

+

Example

+
+use anyhow::{anyhow, Result};
+
+fn lookup(key: &str) -> Result<V> {
+    if key.len() != 16 {
+        return Err(anyhow!("key length must be 16 characters, got {:?}", key));
+    }
+
+    // ...
+}
+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.bail!.html b/tests/html/1.49.0/anyhow/macro.bail!.html new file mode 100644 index 0000000..6a9910e --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.bail!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.bail.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.bail.html b/tests/html/1.49.0/anyhow/macro.bail.html new file mode 100644 index 0000000..c54a909 --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.bail.html @@ -0,0 +1,29 @@ +anyhow::bail - Rust + +

[][src]Macro anyhow::bail

+macro_rules! bail {
+    ($msg:literal $(,)?) => { ... };
+    ($err:expr $(,)?) => { ... };
+    ($fmt:expr, $($arg:tt)*) => { ... };
+}
+

Return early with an error.

+

This macro is equivalent to return Err(From::from($err)).

+

Example

+
+if !has_permission(user, resource) {
+    bail!("permission denied for accessing {}", resource);
+}
+ +
+#[derive(Error, Debug)]
+enum ScienceError {
+    #[error("recursion limit exceeded")]
+    RecursionLimitExceeded,
+    ...
+}
+
+if depth > MAX_DEPTH {
+    bail!(ScienceError::RecursionLimitExceeded);
+}
+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.ensure!.html b/tests/html/1.49.0/anyhow/macro.ensure!.html new file mode 100644 index 0000000..c107543 --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.ensure!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.ensure.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/macro.ensure.html b/tests/html/1.49.0/anyhow/macro.ensure.html new file mode 100644 index 0000000..3620ead --- /dev/null +++ b/tests/html/1.49.0/anyhow/macro.ensure.html @@ -0,0 +1,28 @@ +anyhow::ensure - Rust + +

[][src]Macro anyhow::ensure

+macro_rules! ensure {
+    ($cond:expr, $msg:literal $(,)?) => { ... };
+    ($cond:expr, $err:expr $(,)?) => { ... };
+    ($cond:expr, $fmt:expr, $($arg:tt)*) => { ... };
+}
+

Return early with an error if a condition is not satisfied.

+

This macro is equivalent to if !$cond { return Err(From::from($err)); }.

+

Analogously to assert!, ensure! takes a condition and exits the function +if the condition fails. Unlike assert!, ensure! returns an Error +rather than panicking.

+

Example

+
+ensure!(user == 0, "only user 0 is allowed");
+ +
+#[derive(Error, Debug)]
+enum ScienceError {
+    #[error("recursion limit exceeded")]
+    RecursionLimitExceeded,
+    ...
+}
+
+ensure!(depth <= MAX_DEPTH, ScienceError::RecursionLimitExceeded);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/sidebar-items.js b/tests/html/1.49.0/anyhow/sidebar-items.js new file mode 100644 index 0000000..c8f1a60 --- /dev/null +++ b/tests/html/1.49.0/anyhow/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"macro":[["anyhow","Construct an ad-hoc error from a string."],["bail","Return early with an error."],["ensure","Return early with an error if a condition is not satisfied."]],"struct":[["Chain","Iterator of a chain of source errors."],["Error","The `Error` type, a wrapper around a dynamic error type."]],"trait":[["Context","Provides the `context` method for `Result`."]],"type":[["Result","`Result`"]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/struct.Chain.html b/tests/html/1.49.0/anyhow/struct.Chain.html new file mode 100644 index 0000000..e407a64 --- /dev/null +++ b/tests/html/1.49.0/anyhow/struct.Chain.html @@ -0,0 +1,160 @@ +anyhow::Chain - Rust + +

[][src]Struct anyhow::Chain

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

Iterator of a chain of source errors.

+

This type is the iterator returned by Error::chain.

+

Example

+
+use anyhow::Error;
+use std::io;
+
+pub fn underlying_io_error_kind(error: &Error) -> Option<io::ErrorKind> {
+    for cause in error.chain() {
+        if let Some(io_error) = cause.downcast_ref::<io::Error>() {
+            return Some(io_error.kind());
+        }
+    }
+    None
+}
+

Implementations

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

pub fn new(head: &'a (dyn StdError + 'static)) -> Self[src]

Trait Implementations

impl<'a> Clone for Chain<'a>[src]

impl<'_> Default for Chain<'_>[src]

impl<'_> DoubleEndedIterator for Chain<'_>[src]

impl<'_> ExactSizeIterator for Chain<'_>[src]

impl<'a> Iterator for Chain<'a>[src]

type Item = &'a (dyn StdError + 'static)

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Chain<'a>

impl<'a> !Send for Chain<'a>

impl<'a> !Sync for Chain<'a>

impl<'a> Unpin for Chain<'a>

impl<'a> !UnwindSafe for Chain<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/struct.Error.html b/tests/html/1.49.0/anyhow/struct.Error.html new file mode 100644 index 0000000..dbf6fe2 --- /dev/null +++ b/tests/html/1.49.0/anyhow/struct.Error.html @@ -0,0 +1,261 @@ +anyhow::Error - Rust + +

[][src]Struct anyhow::Error

pub struct Error { /* fields omitted */ }

The Error type, a wrapper around a dynamic error type.

+

Error works a lot like Box<dyn std::error::Error>, but with these +differences:

+
    +
  • Error requires that the error is Send, Sync, and 'static.
  • +
  • Error guarantees that a backtrace is available, even if the underlying +error type does not provide one.
  • +
  • Error is represented as a narrow pointer — exactly one word in +size instead of two.
  • +
+
+

Display representations

+

When you print an error object using "{}" or to_string(), only the outermost +underlying error or context is printed, not any of the lower level causes. +This is exactly as if you had called the Display impl of the error from +which you constructed your anyhow::Error.

+
Failed to read instrs from ./path/to/instrs.json
+
+

To print causes as well using anyhow's default formatting of causes, use the +alternate selector "{:#}".

+
Failed to read instrs from ./path/to/instrs.json: No such file or directory (os error 2)
+
+

The Debug format "{:?}" includes your backtrace if one was captured. Note +that this is the representation you get by default if you return an error +from fn main instead of printing it explicitly yourself.

+
Error: Failed to read instrs from ./path/to/instrs.json
+
+Caused by:
+    No such file or directory (os error 2)
+
+

and if there is a backtrace available:

+
Error: Failed to read instrs from ./path/to/instrs.json
+
+Caused by:
+    No such file or directory (os error 2)
+
+Stack backtrace:
+   0: <E as anyhow::context::ext::StdError>::ext_context
+             at /git/anyhow/src/backtrace.rs:26
+   1: core::result::Result<T,E>::map_err
+             at /git/rustc/src/libcore/result.rs:596
+   2: anyhow::context::<impl anyhow::Context<T,E> for core::result::Result<T,E>>::with_context
+             at /git/anyhow/src/context.rs:58
+   3: testing::main
+             at src/main.rs:5
+   4: std::rt::lang_start
+             at /git/rustc/src/libstd/rt.rs:61
+   5: main
+   6: __libc_start_main
+   7: _start
+
+

To see a conventional struct-style Debug representation, use "{:#?}".

+
Error {
+    context: "Failed to read instrs from ./path/to/instrs.json",
+    source: Os {
+        code: 2,
+        kind: NotFound,
+        message: "No such file or directory",
+    },
+}
+
+

If none of the built-in representations are appropriate and you would prefer +to render the error and its cause chain yourself, it can be done something +like this:

+ +
+use anyhow::{Context, Result};
+
+fn main() {
+    if let Err(err) = try_main() {
+        eprintln!("ERROR: {}", err);
+        err.chain().skip(1).for_each(|cause| eprintln!("because: {}", cause));
+        std::process::exit(1);
+    }
+}
+
+fn try_main() -> Result<()> {
+    ...
+}
+

Implementations

impl Error[src]

pub fn new<E>(error: E) -> Self where
    E: StdError + Send + Sync + 'static, 
[src]

Create a new error object from any error type.

+

The error type must be threadsafe and 'static, so that the Error +will be as well.

+

If the error type does not provide a backtrace, a backtrace will be +created here to ensure that a backtrace exists.

+

pub fn msg<M>(message: M) -> Self where
    M: Display + Debug + Send + Sync + 'static, 
[src]

Create a new error object from a printable error message.

+

If the argument implements std::error::Error, prefer Error::new +instead which preserves the underlying error's cause chain and +backtrace. If the argument may or may not implement std::error::Error +now or in the future, use anyhow!(err) which handles either way +correctly.

+

Error::msg("...") is equivalent to anyhow!("...") but occasionally +convenient in places where a function is preferable over a macro, such +as iterator or stream combinators:

+ +
+use anyhow::{Error, Result};
+use futures::stream::{Stream, StreamExt, TryStreamExt};
+
+async fn demo<S>(stream: S) -> Result<Vec<Output>>
+where
+    S: Stream<Item = Input>,
+{
+    stream
+        .then(ffi::do_some_work) // returns Result<Output, &str>
+        .map_err(Error::msg)
+        .try_collect()
+        .await
+}
+

pub fn context<C>(self, context: C) -> Self where
    C: Display + Send + Sync + 'static, 
[src]

Wrap the error value with additional context.

+

For attaching context to a Result as it is propagated, the +Context extension trait may be more convenient than +this function.

+

The primary reason to use error.context(...) instead of +result.context(...) via the Context trait would be if the context +needs to depend on some data held by the underlying error:

+ +
+use anyhow::Result;
+use std::fs::File;
+use std::path::Path;
+
+struct ParseError {
+    line: usize,
+    column: usize,
+}
+
+fn parse_impl(file: File) -> Result<T, ParseError> {
+    ...
+}
+
+pub fn parse(path: impl AsRef<Path>) -> Result<T> {
+    let file = File::open(&path)?;
+    parse_impl(file).map_err(|error| {
+        let context = format!(
+            "only the first {} lines of {} are valid",
+            error.line, path.as_ref().display(),
+        );
+        anyhow::Error::new(error).context(context)
+    })
+}
+

pub fn chain(&self) -> Chain<'_>

Notable traits for Chain<'a>

impl<'a> Iterator for Chain<'a> type Item = &'a (dyn StdError + 'static);
[src]

An iterator of the chain of source errors contained by this Error.

+

This iterator will visit every error in the cause chain of this error +object, beginning with the error that this error object was created +from.

+

Example

+
+use anyhow::Error;
+use std::io;
+
+pub fn underlying_io_error_kind(error: &Error) -> Option<io::ErrorKind> {
+    for cause in error.chain() {
+        if let Some(io_error) = cause.downcast_ref::<io::Error>() {
+            return Some(io_error.kind());
+        }
+    }
+    None
+}
+

pub fn root_cause(&self) -> &(dyn StdError + 'static)[src]

The lowest level cause of this error — this error's cause's +cause's cause etc.

+

The root cause is the last error in the iterator produced by +chain().

+

pub fn is<E>(&self) -> bool where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Returns true if E is the type held by this error object.

+

For errors with context, this method returns true if E matches the +type of the context C or the type of the error on which the +context has been attached. For details about the interaction between +context and downcasting, see here.

+

pub fn downcast<E>(self) -> Result<E, Self> where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Attempt to downcast the error object to a concrete type.

+

pub fn downcast_ref<E>(&self) -> Option<&E> where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Downcast this error object by reference.

+

Example

+
+// If the error was caused by redaction, then return a tombstone instead
+// of the content.
+match root_cause.downcast_ref::<DataStoreError>() {
+    Some(DataStoreError::Censored(_)) => Ok(Poll::Ready(REDACTED_CONTENT)),
+    None => Err(error),
+}
+

pub fn downcast_mut<E>(&mut self) -> Option<&mut E> where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Downcast this error object by mutable reference.

+

Methods from Deref<Target = dyn StdError + Send + Sync + 'static>

pub fn is<T>(&self) -> bool where
    T: 'static + Error
1.3.0[src]

Returns true if the boxed type is the same as T

+

pub fn downcast_ref<T>(&self) -> Option<&T> where
    T: 'static + Error
1.3.0[src]

Returns some reference to the boxed value if it is of type T, or +None if it isn't.

+

pub fn downcast_mut<T>(&mut self) -> Option<&mut T> where
    T: 'static + Error
1.3.0[src]

Returns some mutable reference to the boxed value if it is of type T, or +None if it isn't.

+

pub fn is<T>(&self) -> bool where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn downcast_ref<T>(&self) -> Option<&T> where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn downcast_mut<T>(&mut self) -> Option<&mut T> where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn is<T>(&self) -> bool where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn downcast_ref<T>(&self) -> Option<&T> where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn downcast_mut<T>(&mut self) -> Option<&mut T> where
    T: 'static + Error
1.3.0[src]

Forwards to the method defined on the type dyn Error.

+

pub fn chain(&self) -> Chain<'_>[src]

🔬 This is a nightly-only experimental API. (error_iter)

Returns an iterator starting with the current error and continuing with +recursively calling Error::source.

+

If you want to omit the current error and only use its sources, +use skip(1).

+

Examples

+
+#![feature(error_iter)]
+use std::error::Error;
+use std::fmt;
+
+#[derive(Debug)]
+struct A;
+
+#[derive(Debug)]
+struct B(Option<Box<dyn Error + 'static>>);
+
+impl fmt::Display for A {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "A")
+    }
+}
+
+impl fmt::Display for B {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "B")
+    }
+}
+
+impl Error for A {}
+
+impl Error for B {
+    fn source(&self) -> Option<&(dyn Error + 'static)> {
+        self.0.as_ref().map(|e| e.as_ref())
+    }
+}
+
+let b = B(Some(Box::new(A)));
+
+// let err : Box<Error> = b.into(); // or
+let err = &b as &(dyn Error);
+
+let mut iter = err.chain();
+
+assert_eq!("B".to_string(), iter.next().unwrap().to_string());
+assert_eq!("A".to_string(), iter.next().unwrap().to_string());
+assert!(iter.next().is_none());
+assert!(iter.next().is_none());
+

Trait Implementations

impl AsRef<dyn Error + 'static + Sync + Send> for Error[src]

impl AsRef<dyn Error + 'static> for Error[src]

impl Debug for Error[src]

impl Deref for Error[src]

type Target = dyn StdError + Send + Sync + 'static

The resulting type after dereferencing.

+

impl DerefMut for Error[src]

impl Display for Error[src]

impl Drop for Error[src]

impl<E> From<E> for Error where
    E: StdError + Send + Sync + 'static, 
[src]

impl From<Error> for Box<dyn StdError + Send + Sync + 'static>[src]

impl From<Error> for Box<dyn StdError + 'static>[src]

Auto Trait Implementations

impl RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/trait.Context.html b/tests/html/1.49.0/anyhow/trait.Context.html new file mode 100644 index 0000000..4a31ac3 --- /dev/null +++ b/tests/html/1.49.0/anyhow/trait.Context.html @@ -0,0 +1,114 @@ +anyhow::Context - Rust + +

[][src]Trait anyhow::Context

pub trait Context<T, E>: Sealed {
+    fn context<C>(self, context: C) -> Result<T, Error>
    where
        C: Display + Send + Sync + 'static
; +
fn with_context<C, F>(self, f: F) -> Result<T, Error>
    where
        C: Display + Send + Sync + 'static,
        F: FnOnce() -> C
; +}

Provides the context method for Result.

+

This trait is sealed and cannot be implemented for types outside of +anyhow.

+
+

Example

+
+use anyhow::{Context, Result};
+use std::fs;
+use std::path::PathBuf;
+
+pub struct ImportantThing {
+    path: PathBuf,
+}
+
+impl ImportantThing {
+    pub fn detach(&mut self) -> Result<()> {...}
+}
+
+pub fn do_it(mut it: ImportantThing) -> Result<Vec<u8>> {
+    it.detach().context("Failed to detach the important thing")?;
+
+    let path = &it.path;
+    let content = fs::read(path)
+        .with_context(|| format!("Failed to read instrs from {}", path.display()))?;
+
+    Ok(content)
+}
+

When printed, the outermost context would be printed first and the lower +level underlying causes would be enumerated below.

+
Error: Failed to read instrs from ./path/to/instrs.json
+
+Caused by:
+    No such file or directory (os error 2)
+
+
+

Effect on downcasting

+

After attaching context of type C onto an error of type E, the resulting +anyhow::Error may be downcast to C or to E.

+

That is, in codebases that rely on downcasting, Anyhow's context supports +both of the following use cases:

+
    +
  • +

    Attaching context whose type is insignificant onto errors whose type +is used in downcasts.

    +

    In other error libraries whose context is not designed this way, it can +be risky to introduce context to existing code because new context might +break existing working downcasts. In Anyhow, any downcast that worked +before adding context will continue to work after you add a context, so +you should freely add human-readable context to errors wherever it would +be helpful.

    + +
    +use anyhow::{Context, Result};
    +
    +fn do_it() -> Result<()> {
    +    helper().context("Failed to complete the work")?;
    +    ...
    +}
    +
    +fn main() {
    +    let err = do_it().unwrap_err();
    +    if let Some(e) = err.downcast_ref::<SuspiciousError>() {
    +        // If helper() returned SuspiciousError, this downcast will
    +        // correctly succeed even with the context in between.
    +    }
    +}
    +
  • +
  • +

    Attaching context whose type is used in downcasts onto errors whose +type is insignificant.

    +

    Some codebases prefer to use machine-readable context to categorize +lower level errors in a way that will be actionable to higher levels of +the application.

    + +
    +use anyhow::{Context, Result};
    +
    +fn do_it() -> Result<()> {
    +    helper().context(HelperFailed)?;
    +    ...
    +}
    +
    +fn main() {
    +    let err = do_it().unwrap_err();
    +    if let Some(e) = err.downcast_ref::<HelperFailed>() {
    +        // If helper failed, this downcast will succeed because
    +        // HelperFailed is the context that has been attached to
    +        // that error.
    +    }
    +}
    +
  • +
+

Required methods

fn context<C>(self, context: C) -> Result<T, Error> where
    C: Display + Send + Sync + 'static, 

Wrap the error value with additional context.

+

fn with_context<C, F>(self, f: F) -> Result<T, Error> where
    C: Display + Send + Sync + 'static,
    F: FnOnce() -> C, 

Wrap the error value with additional context that is evaluated lazily +only once an error does occur.

+
Loading content...

Implementations on Foreign Types

impl<T, E> Context<T, E> for Result<T, E> where
    E: StdError + Send + Sync + 'static, 
[src]

impl<T> Context<T, Infallible> for Option<T>[src]

+
+use anyhow::{Context, Result};
+
+fn maybe_get() -> Option<T> {
+    ...
+}
+
+fn demo() -> Result<()> {
+    let t = maybe_get().context("there is no T")?;
+    ...
+}
+
Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/anyhow/type.Result.html b/tests/html/1.49.0/anyhow/type.Result.html new file mode 100644 index 0000000..ba184a7 --- /dev/null +++ b/tests/html/1.49.0/anyhow/type.Result.html @@ -0,0 +1,28 @@ +anyhow::Result - Rust + +

[][src]Type Definition anyhow::Result

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

Result<T, Error>

+

This is a reasonable return type to use throughout your application but also +for fn main; if you do, failures will be printed along with any +context and a backtrace if one was captured.

+

anyhow::Result may be used with one or two type parameters.

+ +
+use anyhow::Result;
+
+fn demo1() -> Result<T> {...}
+           // ^ equivalent to std::result::Result<T, anyhow::Error>
+
+fn demo2() -> Result<T, OtherError> {...}
+           // ^ equivalent to std::result::Result<T, OtherError>
+

Example

+
+use anyhow::Result;
+
+fn main() -> Result<()> {
+    let config = std::fs::read_to_string("cluster.json")?;
+    let map: ClusterMap = serde_json::from_str(&config)?;
+    println!("cluster info: {:#?}", map);
+    Ok(())
+}
+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/all.html b/tests/html/1.49.0/kuchiki/all.html new file mode 100644 index 0000000..e5e1a32 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/all.html @@ -0,0 +1,6 @@ +List of all items in this crate + +

[] + + List of all items

Structs

Enums

Traits

Functions

\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/attributes/struct.Attribute.html b/tests/html/1.49.0/kuchiki/attributes/struct.Attribute.html new file mode 100644 index 0000000..b8448d0 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/attributes/struct.Attribute.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Attribute.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/attributes/struct.Attributes.html b/tests/html/1.49.0/kuchiki/attributes/struct.Attributes.html new file mode 100644 index 0000000..b96f2a9 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/attributes/struct.Attributes.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Attributes.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/attributes/struct.ExpandedName.html b/tests/html/1.49.0/kuchiki/attributes/struct.ExpandedName.html new file mode 100644 index 0000000..1c25971 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/attributes/struct.ExpandedName.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.ExpandedName.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/enum.NodeData.html b/tests/html/1.49.0/kuchiki/enum.NodeData.html new file mode 100644 index 0000000..7980fde --- /dev/null +++ b/tests/html/1.49.0/kuchiki/enum.NodeData.html @@ -0,0 +1,41 @@ +kuchiki::NodeData - Rust + +

[][src]Enum kuchiki::NodeData

pub enum NodeData {
+    Element(ElementData),
+    Text(RefCell<String>),
+    Comment(RefCell<String>),
+    ProcessingInstruction(RefCell<(String, String)>),
+    Doctype(Doctype),
+    Document(DocumentData),
+    DocumentFragment,
+}

Node data specific to the node type.

+

+ Variants

+
Element(ElementData)

Element node

+

Text node

+
Comment(RefCell<String>)

Comment node

+
ProcessingInstruction(RefCell<(String, String)>)

Processing instruction node

+
Doctype(Doctype)

Doctype node

+
Document(DocumentData)

Document node

+
DocumentFragment

Document fragment node

+

Trait Implementations

impl Clone for NodeData[src]

impl Debug for NodeData[src]

impl PartialEq<NodeData> for NodeData[src]

impl StructuralPartialEq for NodeData[src]

Auto Trait Implementations

impl !RefUnwindSafe for NodeData

impl !Send for NodeData

impl !Sync for NodeData

impl Unpin for NodeData

impl !UnwindSafe for NodeData

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/fn.parse_html.html b/tests/html/1.49.0/kuchiki/fn.parse_html.html new file mode 100644 index 0000000..9090d72 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/fn.parse_html.html @@ -0,0 +1,5 @@ +kuchiki::parse_html - Rust + +

[][src]Function kuchiki::parse_html

pub fn parse_html() -> Parser<Sink>

Parse an HTML document with html5ever and the default configuration.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/fn.parse_html_with_options.html b/tests/html/1.49.0/kuchiki/fn.parse_html_with_options.html new file mode 100644 index 0000000..19afa4c --- /dev/null +++ b/tests/html/1.49.0/kuchiki/fn.parse_html_with_options.html @@ -0,0 +1,5 @@ +kuchiki::parse_html_with_options - Rust + +

[][src]Function kuchiki::parse_html_with_options

pub fn parse_html_with_options(opts: ParseOpts) -> Parser<Sink>

Parse an HTML document with html5ever with custom configuration.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/index.html b/tests/html/1.49.0/kuchiki/index.html new file mode 100644 index 0000000..e9347cd --- /dev/null +++ b/tests/html/1.49.0/kuchiki/index.html @@ -0,0 +1,28 @@ +kuchiki - Rust + +

[][src]Crate kuchiki

Kuchiki (朽木), a HTML/XML tree manipulation library for Rust.

+

Modules

+
iter

Node iterators

+
traits

This module re-exports a number of traits that are useful when using Kuchiki. +It can be used with:

+

Structs

+
Attribute

The non-identifying parts of an attribute

+
Attributes

Convenience wrapper around a btreemap that adds method for attributes in the null namespace.

+
Doctype

Data specific to doctype nodes.

+
DocumentData

Data specific to document nodes.

+
ElementData

Data specific to element nodes.

+
ExpandedName

https://www.w3.org/TR/REC-xml-names/#dt-expname

+
Node

A node inside a DOM-like tree.

+
NodeDataRef

Holds a strong reference to a node, but dereferences to some component inside of it.

+
NodeRef

A strong reference to a node.

+
ParseOpts

Options for the HTML parser.

+
Selector

A pre-compiled CSS Selector.

+
Selectors

A pre-compiled list of CSS Selectors.

+
Specificity

The specificity of a selector.

+

Enums

+
NodeData

Node data specific to the node type.

+

Functions

+
parse_html

Parse an HTML document with html5ever and the default configuration.

+
parse_html_with_options

Parse an HTML document with html5ever with custom configuration.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/enum.NodeEdge.html b/tests/html/1.49.0/kuchiki/iter/enum.NodeEdge.html new file mode 100644 index 0000000..a6fbaf1 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/enum.NodeEdge.html @@ -0,0 +1,35 @@ +kuchiki::iter::NodeEdge - Rust + +

[][src]Enum kuchiki::iter::NodeEdge

pub enum NodeEdge<T> {
+    Start(T),
+    End(T),
+}

Marks either the start or the end of a node.

+

+ Variants

+
Start(T)

Indicates that start of a node that has children. +Yielded by Traverse::next before the node’s descendants. +In HTML or XML, this corresponds to an opening tag like <div>

+
End(T)

Indicates that end of a node that has children. +Yielded by Traverse::next after the node’s descendants. +In HTML or XML, this corresponds to a closing tag like </div>

+

Trait Implementations

impl<T: Clone> Clone for NodeEdge<T>[src]

impl<T: Copy> Copy for NodeEdge<T>[src]

impl<T: Debug> Debug for NodeEdge<T>[src]

impl<T: Eq> Eq for NodeEdge<T>[src]

impl<T: PartialEq> PartialEq<NodeEdge<T>> for NodeEdge<T>[src]

impl<T> StructuralEq for NodeEdge<T>[src]

impl<T> StructuralPartialEq for NodeEdge<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for NodeEdge<T> where
    T: RefUnwindSafe

impl<T> Send for NodeEdge<T> where
    T: Send

impl<T> Sync for NodeEdge<T> where
    T: Sync

impl<T> Unpin for NodeEdge<T> where
    T: Unpin

impl<T> UnwindSafe for NodeEdge<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/index.html b/tests/html/1.49.0/kuchiki/iter/index.html new file mode 100644 index 0000000..2c9434b --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/index.html @@ -0,0 +1,19 @@ +kuchiki::iter - Rust + +

[][src]Module kuchiki::iter

Node iterators

+

Structs

+
Ancestors

An iterator on ancestor nodes.

+
Comments

A node iterator adaptor that yields comment nodes.

+
Descendants

An iterator of references to a given node and its descendants, in tree order.

+
Elements

A node iterator adaptor that yields element nodes.

+
Select

An element iterator adaptor that yields elements maching given selectors.

+
Siblings

A double-ended iterator of sibling nodes.

+
TextNodes

A node iterator adaptor that yields text nodes.

+
Traverse

An iterator of the start and end edges of the nodes in a given subtree.

+

Enums

+
NodeEdge

Marks either the start or the end of a node.

+

Traits

+
ElementIterator

Convenience methods for element iterators.

+
NodeIterator

Convenience methods for node iterators.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/sidebar-items.js b/tests/html/1.49.0/kuchiki/iter/sidebar-items.js new file mode 100644 index 0000000..a91e8bc --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["NodeEdge","Marks either the start or the end of a node."]],"struct":[["Ancestors","An iterator on ancestor nodes."],["Comments","A node iterator adaptor that yields comment nodes."],["Descendants","An iterator of references to a given node and its descendants, in tree order."],["Elements","A node iterator adaptor that yields element nodes."],["Select","An element iterator adaptor that yields elements maching given selectors."],["Siblings","A double-ended iterator of sibling nodes."],["TextNodes","A node iterator adaptor that yields text nodes."],["Traverse","An iterator of the start and end edges of the nodes in a given subtree."]],"trait":[["ElementIterator","Convenience methods for element iterators."],["NodeIterator","Convenience methods for node iterators."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Ancestors.html b/tests/html/1.49.0/kuchiki/iter/struct.Ancestors.html new file mode 100644 index 0000000..82ee91d --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Ancestors.html @@ -0,0 +1,139 @@ +kuchiki::iter::Ancestors - Rust + +

[][src]Struct kuchiki::iter::Ancestors

pub struct Ancestors(_);

An iterator on ancestor nodes.

+

Trait Implementations

impl Clone for Ancestors[src]

impl Debug for Ancestors[src]

impl Iterator for Ancestors[src]

type Item = NodeRef

The type of the elements being iterated over.

+

Auto Trait Implementations

impl !RefUnwindSafe for Ancestors

impl !Send for Ancestors

impl !Sync for Ancestors

impl Unpin for Ancestors

impl !UnwindSafe for Ancestors

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<I> NodeIterator for I where
    I: Iterator<Item = NodeRef>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Comments.html b/tests/html/1.49.0/kuchiki/iter/struct.Comments.html new file mode 100644 index 0000000..465757e --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Comments.html @@ -0,0 +1,144 @@ +kuchiki::iter::Comments - Rust + +

[][src]Struct kuchiki::iter::Comments

pub struct Comments<I>(pub I);

A node iterator adaptor that yields comment nodes.

+

Trait Implementations

impl<I: Clone> Clone for Comments<I>[src]

impl<I: Debug> Debug for Comments<I>[src]

impl<I> DoubleEndedIterator for Comments<I> where
    I: DoubleEndedIterator<Item = NodeRef>, 
[src]

impl<I> Iterator for Comments<I> where
    I: Iterator<Item = NodeRef>, 
[src]

type Item = NodeDataRef<RefCell<String>>

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<I> RefUnwindSafe for Comments<I> where
    I: RefUnwindSafe

impl<I> Send for Comments<I> where
    I: Send

impl<I> Sync for Comments<I> where
    I: Sync

impl<I> Unpin for Comments<I> where
    I: Unpin

impl<I> UnwindSafe for Comments<I> where
    I: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Descendants.html b/tests/html/1.49.0/kuchiki/iter/struct.Descendants.html new file mode 100644 index 0000000..6f3291d --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Descendants.html @@ -0,0 +1,148 @@ +kuchiki::iter::Descendants - Rust + +

[][src]Struct kuchiki::iter::Descendants

pub struct Descendants(_);

An iterator of references to a given node and its descendants, in tree order.

+

Trait Implementations

impl Clone for Descendants[src]

impl Debug for Descendants[src]

impl DoubleEndedIterator for Descendants[src]

impl Iterator for Descendants[src]

type Item = NodeRef

The type of the elements being iterated over.

+

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<I> NodeIterator for I where
    I: Iterator<Item = NodeRef>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Elements.html b/tests/html/1.49.0/kuchiki/iter/struct.Elements.html new file mode 100644 index 0000000..c3126c2 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Elements.html @@ -0,0 +1,145 @@ +kuchiki::iter::Elements - Rust + +

[][src]Struct kuchiki::iter::Elements

pub struct Elements<I>(pub I);

A node iterator adaptor that yields element nodes.

+

Trait Implementations

impl<I: Clone> Clone for Elements<I>[src]

impl<I: Debug> Debug for Elements<I>[src]

impl<I> DoubleEndedIterator for Elements<I> where
    I: DoubleEndedIterator<Item = NodeRef>, 
[src]

impl<I> Iterator for Elements<I> where
    I: Iterator<Item = NodeRef>, 
[src]

type Item = NodeDataRef<ElementData>

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<I> RefUnwindSafe for Elements<I> where
    I: RefUnwindSafe

impl<I> Send for Elements<I> where
    I: Send

impl<I> Sync for Elements<I> where
    I: Sync

impl<I> Unpin for Elements<I> where
    I: Unpin

impl<I> UnwindSafe for Elements<I> where
    I: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<I> ElementIterator for I where
    I: Iterator<Item = NodeDataRef<ElementData>>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Select.html b/tests/html/1.49.0/kuchiki/iter/struct.Select.html new file mode 100644 index 0000000..47a78ad --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Select.html @@ -0,0 +1,144 @@ +kuchiki::iter::Select - Rust + +

[][src]Struct kuchiki::iter::Select

pub struct Select<I, S = Selectors> where
    I: Iterator<Item = NodeDataRef<ElementData>>,
    S: Borrow<Selectors>, 
{ + pub iter: I, + pub selectors: S, +}

An element iterator adaptor that yields elements maching given selectors.

+

+ Fields

iter: I

The underlying iterator.

+
selectors: S

The selectors to be matched.

+

Trait Implementations

impl<I, S> DoubleEndedIterator for Select<I, S> where
    I: DoubleEndedIterator<Item = NodeDataRef<ElementData>>,
    S: Borrow<Selectors>, 
[src]

impl<I, S> Iterator for Select<I, S> where
    I: Iterator<Item = NodeDataRef<ElementData>>,
    S: Borrow<Selectors>, 
[src]

type Item = NodeDataRef<ElementData>

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<I, S> RefUnwindSafe for Select<I, S> where
    I: RefUnwindSafe,
    S: RefUnwindSafe

impl<I, S> Send for Select<I, S> where
    I: Send,
    S: Send

impl<I, S> Sync for Select<I, S> where
    I: Sync,
    S: Sync

impl<I, S> Unpin for Select<I, S> where
    I: Unpin,
    S: Unpin

impl<I, S> UnwindSafe for Select<I, S> where
    I: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<I> ElementIterator for I where
    I: Iterator<Item = NodeDataRef<ElementData>>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Siblings.html b/tests/html/1.49.0/kuchiki/iter/struct.Siblings.html new file mode 100644 index 0000000..a95bad2 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Siblings.html @@ -0,0 +1,148 @@ +kuchiki::iter::Siblings - Rust + +

[][src]Struct kuchiki::iter::Siblings

pub struct Siblings(_);

A double-ended iterator of sibling nodes.

+

Trait Implementations

impl Clone for Siblings[src]

impl Debug for Siblings[src]

impl DoubleEndedIterator for Siblings[src]

impl Iterator for Siblings[src]

type Item = NodeRef

The type of the elements being iterated over.

+

Auto Trait Implementations

impl !RefUnwindSafe for Siblings

impl !Send for Siblings

impl !Sync for Siblings

impl Unpin for Siblings

impl !UnwindSafe for Siblings

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<I> NodeIterator for I where
    I: Iterator<Item = NodeRef>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.TextNodes.html b/tests/html/1.49.0/kuchiki/iter/struct.TextNodes.html new file mode 100644 index 0000000..13c9ab0 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.TextNodes.html @@ -0,0 +1,144 @@ +kuchiki::iter::TextNodes - Rust + +

[][src]Struct kuchiki::iter::TextNodes

pub struct TextNodes<I>(pub I);

A node iterator adaptor that yields text nodes.

+

Trait Implementations

impl<I: Clone> Clone for TextNodes<I>[src]

impl<I: Debug> Debug for TextNodes<I>[src]

impl<I> DoubleEndedIterator for TextNodes<I> where
    I: DoubleEndedIterator<Item = NodeRef>, 
[src]

impl<I> Iterator for TextNodes<I> where
    I: Iterator<Item = NodeRef>, 
[src]

type Item = NodeDataRef<RefCell<String>>

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<I> RefUnwindSafe for TextNodes<I> where
    I: RefUnwindSafe

impl<I> Send for TextNodes<I> where
    I: Send

impl<I> Sync for TextNodes<I> where
    I: Sync

impl<I> Unpin for TextNodes<I> where
    I: Unpin

impl<I> UnwindSafe for TextNodes<I> where
    I: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/struct.Traverse.html b/tests/html/1.49.0/kuchiki/iter/struct.Traverse.html new file mode 100644 index 0000000..04e9709 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/struct.Traverse.html @@ -0,0 +1,144 @@ +kuchiki::iter::Traverse - Rust + +

[][src]Struct kuchiki::iter::Traverse

pub struct Traverse(_);

An iterator of the start and end edges of the nodes in a given subtree.

+

Trait Implementations

impl Clone for Traverse[src]

impl Debug for Traverse[src]

impl DoubleEndedIterator for Traverse[src]

impl Iterator for Traverse[src]

type Item = NodeEdge<NodeRef>

The type of the elements being iterated over.

+

Auto Trait Implementations

impl !RefUnwindSafe for Traverse

impl !Send for Traverse

impl !Sync for Traverse

impl Unpin for Traverse

impl !UnwindSafe for Traverse

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/trait.ElementIterator.html b/tests/html/1.49.0/kuchiki/iter/trait.ElementIterator.html new file mode 100644 index 0000000..3c070d8 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/trait.ElementIterator.html @@ -0,0 +1,8 @@ +kuchiki::iter::ElementIterator - Rust + +

[][src]Trait kuchiki::iter::ElementIterator

pub trait ElementIterator: Sized + Iterator<Item = NodeDataRef<ElementData>> {
+    fn select(self, selectors: &str) -> Result<Select<Self>, ()> { ... }
+}

Convenience methods for element iterators.

+

Provided methods

fn select(self, selectors: &str) -> Result<Select<Self>, ()>

Filter this element iterator to elements maching the given selectors.

+
Loading content...

Implementors

impl<I> ElementIterator for I where
    I: Iterator<Item = NodeDataRef<ElementData>>, 
[src]

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/iter/trait.NodeIterator.html b/tests/html/1.49.0/kuchiki/iter/trait.NodeIterator.html new file mode 100644 index 0000000..d0be761 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/iter/trait.NodeIterator.html @@ -0,0 +1,14 @@ +kuchiki::iter::NodeIterator - Rust + +

[][src]Trait kuchiki::iter::NodeIterator

pub trait NodeIterator: Sized + Iterator<Item = NodeRef> {
+    fn elements(self) -> Elements<Self>

Notable traits for Elements<I>

impl<I> Iterator for Elements<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<ElementData>;
{ ... } +
fn text_nodes(self) -> TextNodes<Self>

Notable traits for TextNodes<I>

impl<I> Iterator for TextNodes<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<RefCell<String>>;
{ ... } +
fn comments(self) -> Comments<Self>

Notable traits for Comments<I>

impl<I> Iterator for Comments<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<RefCell<String>>;
{ ... } +
fn select(self, selectors: &str) -> Result<Select<Elements<Self>>, ()> { ... } +}

Convenience methods for node iterators.

+

Provided methods

fn elements(self) -> Elements<Self>

Notable traits for Elements<I>

impl<I> Iterator for Elements<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<ElementData>;

Filter this element iterator to elements.

+

fn text_nodes(self) -> TextNodes<Self>

Notable traits for TextNodes<I>

impl<I> Iterator for TextNodes<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<RefCell<String>>;

Filter this node iterator to text nodes.

+

fn comments(self) -> Comments<Self>

Notable traits for Comments<I>

impl<I> Iterator for Comments<I> where
    I: Iterator<Item = NodeRef>, 
type Item = NodeDataRef<RefCell<String>>;

Filter this node iterator to comment nodes.

+

fn select(self, selectors: &str) -> Result<Select<Elements<Self>>, ()>

Filter this node iterator to elements maching the given selectors.

+
Loading content...

Implementors

impl<I> NodeIterator for I where
    I: Iterator<Item = NodeRef>, 
[src]

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/node_data_ref/struct.NodeDataRef.html b/tests/html/1.49.0/kuchiki/node_data_ref/struct.NodeDataRef.html new file mode 100644 index 0000000..eed15b8 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/node_data_ref/struct.NodeDataRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.NodeDataRef.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/parser/fn.parse_html.html b/tests/html/1.49.0/kuchiki/parser/fn.parse_html.html new file mode 100644 index 0000000..acb2f6c --- /dev/null +++ b/tests/html/1.49.0/kuchiki/parser/fn.parse_html.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/fn.parse_html.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/parser/fn.parse_html_with_options.html b/tests/html/1.49.0/kuchiki/parser/fn.parse_html_with_options.html new file mode 100644 index 0000000..51fac03 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/parser/fn.parse_html_with_options.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/fn.parse_html_with_options.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/parser/struct.ParseOpts.html b/tests/html/1.49.0/kuchiki/parser/struct.ParseOpts.html new file mode 100644 index 0000000..b2a948d --- /dev/null +++ b/tests/html/1.49.0/kuchiki/parser/struct.ParseOpts.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.ParseOpts.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/select/struct.Selector.html b/tests/html/1.49.0/kuchiki/select/struct.Selector.html new file mode 100644 index 0000000..916916c --- /dev/null +++ b/tests/html/1.49.0/kuchiki/select/struct.Selector.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Selector.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/select/struct.Selectors.html b/tests/html/1.49.0/kuchiki/select/struct.Selectors.html new file mode 100644 index 0000000..9f9d47d --- /dev/null +++ b/tests/html/1.49.0/kuchiki/select/struct.Selectors.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Selectors.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/select/struct.Specificity.html b/tests/html/1.49.0/kuchiki/select/struct.Specificity.html new file mode 100644 index 0000000..2e8565e --- /dev/null +++ b/tests/html/1.49.0/kuchiki/select/struct.Specificity.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Specificity.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/sidebar-items.js b/tests/html/1.49.0/kuchiki/sidebar-items.js new file mode 100644 index 0000000..5bbe9ea --- /dev/null +++ b/tests/html/1.49.0/kuchiki/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["NodeData","Node data specific to the node type."]],"fn":[["parse_html","Parse an HTML document with html5ever and the default configuration."],["parse_html_with_options","Parse an HTML document with html5ever with custom configuration."]],"mod":[["iter","Node iterators"],["traits","This module re-exports a number of traits that are useful when using Kuchiki. It can be used with:"]],"struct":[["Attribute","The non-identifying parts of an attribute"],["Attributes","Convenience wrapper around a btreemap that adds method for attributes in the null namespace."],["Doctype","Data specific to doctype nodes."],["DocumentData","Data specific to document nodes."],["ElementData","Data specific to element nodes."],["ExpandedName","https://www.w3.org/TR/REC-xml-names/#dt-expname"],["Node","A node inside a DOM-like tree."],["NodeDataRef","Holds a strong reference to a node, but dereferences to some component inside of it."],["NodeRef","A strong reference to a node."],["ParseOpts","Options for the HTML parser."],["Selector","A pre-compiled CSS Selector."],["Selectors","A pre-compiled list of CSS Selectors."],["Specificity","The specificity of a selector."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Attribute.html b/tests/html/1.49.0/kuchiki/struct.Attribute.html new file mode 100644 index 0000000..900bb4f --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Attribute.html @@ -0,0 +1,30 @@ +kuchiki::Attribute - Rust + +

[][src]Struct kuchiki::Attribute

pub struct Attribute {
+    pub prefix: Option<Prefix>,
+    pub value: String,
+}

The non-identifying parts of an attribute

+

+ Fields

prefix: Option<Prefix>

The namespace prefix, if any

+
value: String

The attribute value

+

Trait Implementations

impl Clone for Attribute[src]

impl Debug for Attribute[src]

impl PartialEq<Attribute> for Attribute[src]

impl StructuralPartialEq for Attribute[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Attributes.html b/tests/html/1.49.0/kuchiki/struct.Attributes.html new file mode 100644 index 0000000..ba81966 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Attributes.html @@ -0,0 +1,34 @@ +kuchiki::Attributes - Rust + +

[][src]Struct kuchiki::Attributes

pub struct Attributes {
+    pub map: BTreeMap<ExpandedName, Attribute>,
+}

Convenience wrapper around a btreemap that adds method for attributes in the null namespace.

+

+ Fields

map: BTreeMap<ExpandedName, Attribute>

A map of attributes whose name can have namespaces.

+

Implementations

impl Attributes[src]

pub fn contains<A: Into<LocalName>>(&self, local_name: A) -> bool[src]

Like BTreeMap::contains

+

pub fn get<A: Into<LocalName>>(&self, local_name: A) -> Option<&str>[src]

Like BTreeMap::get

+

pub fn get_mut<A: Into<LocalName>>(
    &mut self,
    local_name: A
) -> Option<&mut String>
[src]

Like BTreeMap::get_mut

+

pub fn entry<A: Into<LocalName>>(
    &mut self,
    local_name: A
) -> Entry<'_, ExpandedName, Attribute>
[src]

Like BTreeMap::entry

+

pub fn insert<A: Into<LocalName>>(
    &mut self,
    local_name: A,
    value: String
) -> Option<Attribute>
[src]

Like BTreeMap::insert

+

pub fn remove<A: Into<LocalName>>(&mut self, local_name: A) -> Option<Attribute>[src]

Like BTreeMap::remove

+

Trait Implementations

impl Clone for Attributes[src]

impl Debug for Attributes[src]

impl PartialEq<Attributes> for Attributes[src]

impl StructuralPartialEq for Attributes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Doctype.html b/tests/html/1.49.0/kuchiki/struct.Doctype.html new file mode 100644 index 0000000..029f890 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Doctype.html @@ -0,0 +1,32 @@ +kuchiki::Doctype - Rust + +

[][src]Struct kuchiki::Doctype

pub struct Doctype {
+    pub name: String,
+    pub public_id: String,
+    pub system_id: String,
+}

Data specific to doctype nodes.

+

+ Fields

name: String

The name of the doctype

+
public_id: String

The public ID of the doctype

+
system_id: String

The system ID of the doctype

+

Trait Implementations

impl Clone for Doctype[src]

impl Debug for Doctype[src]

impl PartialEq<Doctype> for Doctype[src]

impl StructuralPartialEq for Doctype[src]

Auto Trait Implementations

impl RefUnwindSafe for Doctype

impl Send for Doctype

impl Sync for Doctype

impl Unpin for Doctype

impl UnwindSafe for Doctype

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.DocumentData.html b/tests/html/1.49.0/kuchiki/struct.DocumentData.html new file mode 100644 index 0000000..0c8e280 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.DocumentData.html @@ -0,0 +1,25 @@ +kuchiki::DocumentData - Rust + +

[][src]Struct kuchiki::DocumentData

pub struct DocumentData { /* fields omitted */ }

Data specific to document nodes.

+

Implementations

impl DocumentData[src]

pub fn quirks_mode(&self) -> QuirksMode[src]

The quirks mode of the document, as determined by the HTML parser.

+

Trait Implementations

impl Clone for DocumentData[src]

impl Debug for DocumentData[src]

impl PartialEq<DocumentData> for DocumentData[src]

impl StructuralPartialEq for DocumentData[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.ElementData.html b/tests/html/1.49.0/kuchiki/struct.ElementData.html new file mode 100644 index 0000000..e25e7f8 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.ElementData.html @@ -0,0 +1,33 @@ +kuchiki::ElementData - Rust + +

[][src]Struct kuchiki::ElementData

pub struct ElementData {
+    pub name: QualName,
+    pub attributes: RefCell<Attributes>,
+    pub template_contents: Option<NodeRef>,
+}

Data specific to element nodes.

+

+ Fields

name: QualName

The namespace and local name of the element, such as ns!(html) and body.

+
attributes: RefCell<Attributes>

The attributes of the elements.

+
template_contents: Option<NodeRef>

If the element is an HTML <template> element, +the document fragment node that is the root of template contents.

+

Trait Implementations

impl Clone for ElementData[src]

impl Debug for ElementData[src]

impl PartialEq<ElementData> for ElementData[src]

impl StructuralPartialEq for ElementData[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.ExpandedName.html b/tests/html/1.49.0/kuchiki/struct.ExpandedName.html new file mode 100644 index 0000000..dc5d180 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.ExpandedName.html @@ -0,0 +1,44 @@ +kuchiki::ExpandedName - Rust + +

[][src]Struct kuchiki::ExpandedName

pub struct ExpandedName {
+    pub ns: Namespace,
+    pub local: LocalName,
+}

+ Fields

ns: Namespace

Namespace URL

+
local: LocalName

"Local" part of the name

+

Implementations

impl ExpandedName[src]

pub fn new<N: Into<Namespace>, L: Into<LocalName>>(ns: N, local: L) -> Self[src]

Trivial constructor

+

Trait Implementations

impl Clone for ExpandedName[src]

impl Debug for ExpandedName[src]

impl Eq for ExpandedName[src]

impl Hash for ExpandedName[src]

impl Ord for ExpandedName[src]

impl PartialEq<ExpandedName> for ExpandedName[src]

impl PartialOrd<ExpandedName> for ExpandedName[src]

impl StructuralEq for ExpandedName[src]

impl StructuralPartialEq for ExpandedName[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Node.html b/tests/html/1.49.0/kuchiki/struct.Node.html new file mode 100644 index 0000000..ef57846 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Node.html @@ -0,0 +1,40 @@ +kuchiki::Node - Rust + +

[][src]Struct kuchiki::Node

pub struct Node { /* fields omitted */ }

A node inside a DOM-like tree.

+

Implementations

impl Node[src]

pub fn data(&self) -> &NodeData[src]

Return a reference to this node’s node-type-specific data.

+

pub fn as_element(&self) -> Option<&ElementData>[src]

If this node is an element, return a reference to element-specific data.

+

pub fn as_text(&self) -> Option<&RefCell<String>>[src]

If this node is a text node, return a reference to its contents.

+

pub fn as_comment(&self) -> Option<&RefCell<String>>[src]

If this node is a comment, return a reference to its contents.

+

pub fn as_doctype(&self) -> Option<&Doctype>[src]

If this node is a document, return a reference to doctype-specific data.

+

pub fn as_document(&self) -> Option<&DocumentData>[src]

If this node is a document, return a reference to document-specific data.

+

pub fn parent(&self) -> Option<NodeRef>[src]

Return a reference to the parent node, unless this node is the root of the tree.

+

pub fn first_child(&self) -> Option<NodeRef>[src]

Return a reference to the first child of this node, unless it has no child.

+

pub fn last_child(&self) -> Option<NodeRef>[src]

Return a reference to the last child of this node, unless it has no child.

+

pub fn previous_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the previous sibling of this node, unless it is a first child.

+

pub fn next_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the previous sibling of this node, unless it is a last child.

+

pub fn detach(&self)[src]

Detach a node from its parent and siblings. Children are not affected.

+

To remove a node and its descendants, detach it and drop any strong reference to it.

+

Trait Implementations

impl Debug for Node[src]

impl Drop for Node[src]

Prevent implicit recursion when dropping nodes to avoid overflowing the stack.

+

The implicit drop is correct, but recursive. +In the worst case (where no node has both a next sibling and a child), +a tree of a few tens of thousands of nodes could cause a stack overflow.

+

This Drop implementations makes sure the recursion does not happen. +Instead, it has an explicit Vec<Rc<Node>> stack to traverse the subtree, +but only following Rc<Node> references that are "unique": +that have a strong reference count of 1. +Those are the nodes that would have been dropped recursively.

+

The stack holds ancestors of the current node rather than preceding siblings, +on the assumption that large document trees are typically wider than deep.

+

Auto Trait Implementations

impl !RefUnwindSafe for Node

impl !Send for Node

impl !Sync for Node

impl Unpin for Node

impl !UnwindSafe for Node

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.NodeDataRef.html b/tests/html/1.49.0/kuchiki/struct.NodeDataRef.html new file mode 100644 index 0000000..e71926d --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.NodeDataRef.html @@ -0,0 +1,52 @@ +kuchiki::NodeDataRef - Rust + +

[][src]Struct kuchiki::NodeDataRef

pub struct NodeDataRef<T> { /* fields omitted */ }

Holds a strong reference to a node, but dereferences to some component inside of it.

+

Implementations

impl<T> NodeDataRef<T>[src]

pub fn new<F>(rc: NodeRef, f: F) -> NodeDataRef<T> where
    F: FnOnce(&Node) -> &T, 
[src]

Create a NodeDataRef for a component in a given node.

+

pub fn new_opt<F>(rc: NodeRef, f: F) -> Option<NodeDataRef<T>> where
    F: FnOnce(&Node) -> Option<&T>, 
[src]

Create a NodeDataRef for and a component that may or may not be in a given node.

+

pub fn as_node(&self) -> &NodeRef[src]

Access the corresponding node.

+

impl NodeDataRef<ElementData>[src]

pub fn text_contents(&self) -> String[src]

Return the concatenation of all text nodes in this subtree.

+

Trait Implementations

impl<T> Clone for NodeDataRef<T>[src]

impl<T: Debug> Debug for NodeDataRef<T>[src]

impl<T> Deref for NodeDataRef<T>[src]

type Target = T

The resulting type after dereferencing.

+

impl Element for NodeDataRef<ElementData>[src]

type Impl = KuchikiSelectors

impl<T: Eq> Eq for NodeDataRef<T>[src]

impl<T> PartialEq<NodeDataRef<T>> for NodeDataRef<T>[src]

impl<T> StructuralEq for NodeDataRef<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for NodeDataRef<T>

impl<T> !Send for NodeDataRef<T>

impl<T> !Sync for NodeDataRef<T>

impl<T> Unpin for NodeDataRef<T>

impl<T> !UnwindSafe for NodeDataRef<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.NodeRef.html b/tests/html/1.49.0/kuchiki/struct.NodeRef.html new file mode 100644 index 0000000..9120daf --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.NodeRef.html @@ -0,0 +1,96 @@ +kuchiki::NodeRef - Rust + +

[][src]Struct kuchiki::NodeRef

pub struct NodeRef(pub Rc<Node>);

A strong reference to a node.

+

A node is destroyed when the last strong reference to it dropped.

+

Each node holds a strong reference to its first child and next sibling (if any), +but only a weak reference to its last child, previous sibling, and parent. +This is to avoid strong reference cycles, which would cause memory leaks.

+

As a result, a single NodeRef is sufficient to keep alive a node +and nodes that are after it in tree order +(its descendants, its following siblings, and their descendants) +but not other nodes in a tree.

+

To avoid detroying nodes prematurely, +programs typically hold a strong reference to the root of a document +until they’re done with that document.

+

Implementations

impl NodeRef[src]

pub fn inclusive_ancestors(&self) -> Ancestors

Notable traits for Ancestors

impl Iterator for Ancestors type Item = NodeRef;
[src]

Return an iterator of references to this node and its ancestors.

+

pub fn ancestors(&self) -> Ancestors

Notable traits for Ancestors

impl Iterator for Ancestors type Item = NodeRef;
[src]

Return an iterator of references to this node’s ancestors.

+

pub fn inclusive_preceding_siblings(&self) -> Rev<Siblings>[src]

Return an iterator of references to this node and the siblings before it.

+

pub fn preceding_siblings(&self) -> Rev<Siblings>[src]

Return an iterator of references to this node’s siblings before it.

+

pub fn inclusive_following_siblings(&self) -> Siblings

Notable traits for Siblings

impl Iterator for Siblings type Item = NodeRef;
[src]

Return an iterator of references to this node and the siblings after it.

+

pub fn following_siblings(&self) -> Siblings

Notable traits for Siblings

impl Iterator for Siblings type Item = NodeRef;
[src]

Return an iterator of references to this node’s siblings after it.

+

pub fn children(&self) -> Siblings

Notable traits for Siblings

impl Iterator for Siblings type Item = NodeRef;
[src]

Return an iterator of references to this node’s children.

+

pub fn inclusive_descendants(&self) -> Descendants

Notable traits for Descendants

impl Iterator for Descendants type Item = NodeRef;
[src]

Return an iterator of references to this node and its descendants, in tree order.

+

Parent nodes appear before the descendants.

+

Note: this is the NodeEdge::Start items from traverse().

+

pub fn descendants(&self) -> Descendants

Notable traits for Descendants

impl Iterator for Descendants type Item = NodeRef;
[src]

Return an iterator of references to this node’s descendants, in tree order.

+

Parent nodes appear before the descendants.

+

Note: this is the NodeEdge::Start items from traverse().

+

pub fn traverse_inclusive(&self) -> Traverse

Notable traits for Traverse

impl Iterator for Traverse type Item = NodeEdge<NodeRef>;
[src]

Return an iterator of the start and end edges of this node and its descendants, +in tree order.

+

pub fn traverse(&self) -> Traverse

Notable traits for Traverse

impl Iterator for Traverse type Item = NodeEdge<NodeRef>;
[src]

Return an iterator of the start and end edges of this node’s descendants, +in tree order.

+

pub fn select(
    &self,
    selectors: &str
) -> Result<Select<Elements<Descendants>>, ()>
[src]

Return an iterator of the inclusive descendants element that match the given selector list.

+

pub fn select_first(
    &self,
    selectors: &str
) -> Result<NodeDataRef<ElementData>, ()>
[src]

Return the first inclusive descendants element that match the given selector list.

+

impl NodeRef[src]

pub fn into_element_ref(self) -> Option<NodeDataRef<ElementData>>[src]

If this node is an element, return a strong reference to element-specific data.

+

pub fn into_text_ref(self) -> Option<NodeDataRef<RefCell<String>>>[src]

If this node is a text node, return a strong reference to its contents.

+

pub fn into_comment_ref(self) -> Option<NodeDataRef<RefCell<String>>>[src]

If this node is a comment, return a strong reference to its contents.

+

pub fn into_doctype_ref(self) -> Option<NodeDataRef<Doctype>>[src]

If this node is a doctype, return a strong reference to doctype-specific data.

+

pub fn into_document_ref(self) -> Option<NodeDataRef<DocumentData>>[src]

If this node is a document, return a strong reference to document-specific data.

+

impl NodeRef[src]

pub fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>[src]

Serialize this node and its descendants in HTML syntax to the given stream.

+

pub fn serialize_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Serialize this node and its descendants in HTML syntax to a new file at the given path.

+

impl NodeRef[src]

pub fn new(data: NodeData) -> NodeRef[src]

Create a new node.

+

pub fn new_element<I>(name: QualName, attributes: I) -> NodeRef where
    I: IntoIterator<Item = (ExpandedName, Attribute)>, 
[src]

Create a new element node.

+

pub fn new_text<T: Into<String>>(value: T) -> NodeRef[src]

Create a new text node.

+

pub fn new_comment<T: Into<String>>(value: T) -> NodeRef[src]

Create a new comment node.

+

pub fn new_processing_instruction<T1, T2>(target: T1, data: T2) -> NodeRef where
    T1: Into<String>,
    T2: Into<String>, 
[src]

Create a new processing instruction node.

+

pub fn new_doctype<T1, T2, T3>(
    name: T1,
    public_id: T2,
    system_id: T3
) -> NodeRef where
    T1: Into<String>,
    T2: Into<String>,
    T3: Into<String>, 
[src]

Create a new doctype node.

+

pub fn new_document() -> NodeRef[src]

Create a new document node.

+

pub fn text_contents(&self) -> String[src]

Return the concatenation of all text nodes in this subtree.

+

impl NodeRef[src]

pub fn append(&self, new_child: NodeRef)[src]

Append a new child to this node, after existing children.

+

The new child is detached from its previous position.

+

pub fn prepend(&self, new_child: NodeRef)[src]

Prepend a new child to this node, before existing children.

+

The new child is detached from its previous position.

+

pub fn insert_after(&self, new_sibling: NodeRef)[src]

Insert a new sibling after this node.

+

The new sibling is detached from its previous position.

+

pub fn insert_before(&self, new_sibling: NodeRef)[src]

Insert a new sibling before this node.

+

The new sibling is detached from its previous position.

+

Methods from Deref<Target = Node>

pub fn data(&self) -> &NodeData[src]

Return a reference to this node’s node-type-specific data.

+

pub fn as_element(&self) -> Option<&ElementData>[src]

If this node is an element, return a reference to element-specific data.

+

pub fn as_text(&self) -> Option<&RefCell<String>>[src]

If this node is a text node, return a reference to its contents.

+

pub fn as_comment(&self) -> Option<&RefCell<String>>[src]

If this node is a comment, return a reference to its contents.

+

pub fn as_doctype(&self) -> Option<&Doctype>[src]

If this node is a document, return a reference to doctype-specific data.

+

pub fn as_document(&self) -> Option<&DocumentData>[src]

If this node is a document, return a reference to document-specific data.

+

pub fn parent(&self) -> Option<NodeRef>[src]

Return a reference to the parent node, unless this node is the root of the tree.

+

pub fn first_child(&self) -> Option<NodeRef>[src]

Return a reference to the first child of this node, unless it has no child.

+

pub fn last_child(&self) -> Option<NodeRef>[src]

Return a reference to the last child of this node, unless it has no child.

+

pub fn previous_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the previous sibling of this node, unless it is a first child.

+

pub fn next_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the previous sibling of this node, unless it is a last child.

+

pub fn detach(&self)[src]

Detach a node from its parent and siblings. Children are not affected.

+

To remove a node and its descendants, detach it and drop any strong reference to it.

+

Trait Implementations

impl Clone for NodeRef[src]

impl Debug for NodeRef[src]

impl Deref for NodeRef[src]

type Target = Node

The resulting type after dereferencing.

+

impl Eq for NodeRef[src]

impl PartialEq<NodeRef> for NodeRef[src]

impl Serialize for NodeRef[src]

impl ToString for NodeRef[src]

Auto Trait Implementations

impl !RefUnwindSafe for NodeRef

impl !Send for NodeRef

impl !Sync for NodeRef

impl Unpin for NodeRef

impl !UnwindSafe for NodeRef

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.ParseOpts.html b/tests/html/1.49.0/kuchiki/struct.ParseOpts.html new file mode 100644 index 0000000..e8130c2 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.ParseOpts.html @@ -0,0 +1,23 @@ +kuchiki::ParseOpts - Rust + +

[][src]Struct kuchiki::ParseOpts

pub struct ParseOpts {
+    pub tokenizer: TokenizerOpts,
+    pub tree_builder: TreeBuilderOpts,
+    pub on_parse_error: Option<Box<dyn FnMut(Cow<'static, str>)>>,
+}

Options for the HTML parser.

+

+ Fields

tokenizer: TokenizerOpts

Options for the HTML tokenizer.

+
tree_builder: TreeBuilderOpts

Options for the HTML tree builder.

+
on_parse_error: Option<Box<dyn FnMut(Cow<'static, str>)>>

A callback for HTML parse errors (which are never fatal).

+

Trait Implementations

impl Default for ParseOpts[src]

Auto Trait Implementations

impl !RefUnwindSafe for ParseOpts

impl !Send for ParseOpts

impl !Sync for ParseOpts

impl Unpin for ParseOpts

impl !UnwindSafe for ParseOpts

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Selector.html b/tests/html/1.49.0/kuchiki/struct.Selector.html new file mode 100644 index 0000000..e614d35 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Selector.html @@ -0,0 +1,19 @@ +kuchiki::Selector - Rust + +

[][src]Struct kuchiki::Selector

pub struct Selector(_);

A pre-compiled CSS Selector.

+

Implementations

impl Selector[src]

pub fn matches(&self, element: &NodeDataRef<ElementData>) -> bool[src]

Returns whether the given element matches this selector.

+

pub fn specificity(&self) -> Specificity[src]

Return the specificity of this selector.

+

Trait Implementations

impl Debug for Selector[src]

impl Display for Selector[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Selectors.html b/tests/html/1.49.0/kuchiki/struct.Selectors.html new file mode 100644 index 0000000..03bac80 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Selectors.html @@ -0,0 +1,22 @@ +kuchiki::Selectors - Rust + +

[][src]Struct kuchiki::Selectors

pub struct Selectors(pub Vec<Selector>);

A pre-compiled list of CSS Selectors.

+

Implementations

impl Selectors[src]

pub fn compile(s: &str) -> Result<Selectors, ()>[src]

Compile a list of selectors. This may fail on syntax errors or unsupported selectors.

+

pub fn matches(&self, element: &NodeDataRef<ElementData>) -> bool[src]

Returns whether the given element matches this list of selectors.

+

pub fn filter<I>(&self, iter: I) -> Select<I, &Selectors>

Notable traits for Select<I, S>

impl<I, S> Iterator for Select<I, S> where
    I: Iterator<Item = NodeDataRef<ElementData>>,
    S: Borrow<Selectors>, 
type Item = NodeDataRef<ElementData>;
where
    I: Iterator<Item = NodeDataRef<ElementData>>, 
[src]

Filter an element iterator, yielding those matching this list of selectors.

+

Trait Implementations

impl Debug for Selectors[src]

impl Display for Selectors[src]

impl FromStr for Selectors[src]

type Err = ()

The associated error which can be returned from parsing.

+

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/struct.Specificity.html b/tests/html/1.49.0/kuchiki/struct.Specificity.html new file mode 100644 index 0000000..fa90f63 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/struct.Specificity.html @@ -0,0 +1,39 @@ +kuchiki::Specificity - Rust + +

[][src]Struct kuchiki::Specificity

pub struct Specificity(_);

The specificity of a selector.

+

Opaque, but ordered.

+

Determines precedence in the cascading algorithm. +When equal, a rule later in source order takes precedence.

+

Trait Implementations

impl Clone for Specificity[src]

impl Copy for Specificity[src]

impl Eq for Specificity[src]

impl Hash for Specificity[src]

impl Ord for Specificity[src]

impl PartialEq<Specificity> for Specificity[src]

impl PartialOrd<Specificity> for Specificity[src]

impl StructuralEq for Specificity[src]

impl StructuralPartialEq for Specificity[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/traits/index.html b/tests/html/1.49.0/kuchiki/traits/index.html new file mode 100644 index 0000000..e5e59ef --- /dev/null +++ b/tests/html/1.49.0/kuchiki/traits/index.html @@ -0,0 +1,12 @@ +kuchiki::traits - Rust + +

[][src]Module kuchiki::traits

This module re-exports a number of traits that are useful when using Kuchiki. +It can be used with:

+ +
+use kuchiki::traits::*;
+

Re-exports

+
pub use crate::iter::ElementIterator;
pub use crate::iter::NodeIterator;

Traits

+
TendrilSink

Trait for types that can process a tendril.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/traits/sidebar-items.js b/tests/html/1.49.0/kuchiki/traits/sidebar-items.js new file mode 100644 index 0000000..a4b04fa --- /dev/null +++ b/tests/html/1.49.0/kuchiki/traits/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"trait":[["TendrilSink","Trait for types that can process a tendril."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/traits/trait.TendrilSink.html b/tests/html/1.49.0/kuchiki/traits/trait.TendrilSink.html new file mode 100644 index 0000000..d7658d5 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/traits/trait.TendrilSink.html @@ -0,0 +1,33 @@ +kuchiki::traits::TendrilSink - Rust + +

[]Trait kuchiki::traits::TendrilSink

pub trait TendrilSink<F, A = NonAtomic> where
    A: Atomicity,
    F: Format, 
{ + type Output; + fn process(&mut self, t: Tendril<F, A>); +
fn error(&mut self, desc: Cow<'static, str>); +
fn finish(self) -> Self::Output; + + fn one<T>(self, t: T) -> Self::Output
    where
        T: Into<Tendril<F, A>>
, + { ... } +
fn from_iter<I>(self, i: I) -> Self::Output
    where
        I: IntoIterator,
        <I as IntoIterator>::Item: Into<Tendril<F, A>>
, + { ... } +
fn read_from<R>(self, r: &mut R) -> Result<Self::Output, Error>
    where
        F: SliceFormat<Slice = [u8]>,
        R: Read
, + { ... } +
fn from_file<P>(self, path: P) -> Result<Self::Output, Error>
    where
        F: SliceFormat<Slice = [u8]>,
        P: AsRef<Path>
, + { ... } +}

Trait for types that can process a tendril.

+

This is a "push" interface, unlike the "pull" interface of +Iterator<Item=Tendril<F>>. The push interface matches +html5ever and other incremental parsers with a similar +architecture.

+

Associated Types

type Output

What the overall result of processing is.

+
Loading content...

Required methods

fn process(&mut self, t: Tendril<F, A>)

Process this tendril.

+

fn error(&mut self, desc: Cow<'static, str>)

Indicates that an error has occurred.

+

fn finish(self) -> Self::Output

Indicates the end of the stream.

+
Loading content...

Provided methods

fn one<T>(self, t: T) -> Self::Output where
    T: Into<Tendril<F, A>>, 

Process one tendril and finish.

+

fn from_iter<I>(self, i: I) -> Self::Output where
    I: IntoIterator,
    <I as IntoIterator>::Item: Into<Tendril<F, A>>, 

Consume an iterator of tendrils, processing each item, then finish.

+

fn read_from<R>(self, r: &mut R) -> Result<Self::Output, Error> where
    F: SliceFormat<Slice = [u8]>,
    R: Read

Read from the given stream of bytes until exhaustion and process incrementally, +then finish. Return Err at the first I/O error.

+

fn from_file<P>(self, path: P) -> Result<Self::Output, Error> where
    F: SliceFormat<Slice = [u8]>,
    P: AsRef<Path>, 

Read from the file at the given path and process incrementally, +then finish. Return Err at the first I/O error.

+
Loading content...

Implementations on Foreign Types

impl<Sink> TendrilSink<UTF8, NonAtomic> for Parser<Sink> where
    Sink: TreeSink, 

type Output = <Sink as TreeSink>::Output

impl<Sink, A> TendrilSink<Bytes, A> for Utf8LossyDecoder<Sink, A> where
    A: Atomicity,
    Sink: TendrilSink<UTF8, A>, 

type Output = <Sink as TendrilSink<UTF8, A>>::Output

Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/enum.NodeData.html b/tests/html/1.49.0/kuchiki/tree/enum.NodeData.html new file mode 100644 index 0000000..2fbe632 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/enum.NodeData.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/enum.NodeData.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/struct.Doctype.html b/tests/html/1.49.0/kuchiki/tree/struct.Doctype.html new file mode 100644 index 0000000..829afc2 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/struct.Doctype.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Doctype.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/struct.DocumentData.html b/tests/html/1.49.0/kuchiki/tree/struct.DocumentData.html new file mode 100644 index 0000000..a09fdbe --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/struct.DocumentData.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.DocumentData.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/struct.ElementData.html b/tests/html/1.49.0/kuchiki/tree/struct.ElementData.html new file mode 100644 index 0000000..be78ee4 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/struct.ElementData.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.ElementData.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/struct.Node.html b/tests/html/1.49.0/kuchiki/tree/struct.Node.html new file mode 100644 index 0000000..592e435 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/struct.Node.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.Node.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/kuchiki/tree/struct.NodeRef.html b/tests/html/1.49.0/kuchiki/tree/struct.NodeRef.html new file mode 100644 index 0000000..700be54 --- /dev/null +++ b/tests/html/1.49.0/kuchiki/tree/struct.NodeRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../kuchiki/struct.NodeRef.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/all.html b/tests/html/1.49.0/log/all.html new file mode 100644 index 0000000..443f7ba --- /dev/null +++ b/tests/html/1.49.0/log/all.html @@ -0,0 +1,4 @@ +List of all items in this crate

[] + + List of all items

Structs

Enums

Traits

Macros

Functions

Constants

\ No newline at end of file diff --git a/tests/html/1.49.0/log/constant.STATIC_MAX_LEVEL.html b/tests/html/1.49.0/log/constant.STATIC_MAX_LEVEL.html new file mode 100644 index 0000000..47d791d --- /dev/null +++ b/tests/html/1.49.0/log/constant.STATIC_MAX_LEVEL.html @@ -0,0 +1,7 @@ +log::STATIC_MAX_LEVEL - Rust

[][src]Constant log::STATIC_MAX_LEVEL

pub const STATIC_MAX_LEVEL: LevelFilter;

The statically resolved maximum log level.

+

See the crate level documentation for information on how to configure this.

+

This value is checked by the log macros, but not by the Logger returned by +the logger function. Code that manually calls functions on that value +should compare the level against this value.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/enum.Level.html b/tests/html/1.49.0/log/enum.Level.html new file mode 100644 index 0000000..d72641b --- /dev/null +++ b/tests/html/1.49.0/log/enum.Level.html @@ -0,0 +1,83 @@ +log::Level - Rust

[][src]Enum log::Level

#[repr(usize)]pub enum Level {
+    Error,
+    Warn,
+    Info,
+    Debug,
+    Trace,
+}

An enum representing the available verbosity levels of the logger.

+

Typical usage includes: checking if a certain Level is enabled with +log_enabled!, specifying the Level of +log!, and comparing a Level directly to a +LevelFilter.

+

+ Variants

+
Error

The "error" level.

+

Designates very serious errors.

+
Warn

The "warn" level.

+

Designates hazardous situations.

+
Info

The "info" level.

+

Designates useful information.

+
Debug

The "debug" level.

+

Designates lower priority information.

+
Trace

The "trace" level.

+

Designates very low priority, often extremely verbose, information.

+

Implementations

impl Level[src]

pub fn max() -> Level[src]

Returns the most verbose logging level.

+

pub fn to_level_filter(&self) -> LevelFilter[src]

Converts the Level to the equivalent LevelFilter.

+

Trait Implementations

impl Clone for Level[src]

impl Copy for Level[src]

impl Debug for Level[src]

impl Display for Level[src]

impl Eq for Level[src]

impl FromStr for Level[src]

type Err = ParseLevelError

The associated error which can be returned from parsing.

+

impl Hash for Level[src]

impl Ord for Level[src]

impl PartialEq<Level> for Level[src]

impl PartialEq<Level> for LevelFilter[src]

impl PartialEq<LevelFilter> for Level[src]

impl PartialOrd<Level> for Level[src]

impl PartialOrd<Level> for LevelFilter[src]

impl PartialOrd<LevelFilter> for Level[src]

impl StructuralEq for Level[src]

Auto Trait Implementations

impl RefUnwindSafe for Level

impl Send for Level

impl Sync for Level

impl Unpin for Level

impl UnwindSafe for Level

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/enum.LevelFilter.html b/tests/html/1.49.0/log/enum.LevelFilter.html new file mode 100644 index 0000000..57e2216 --- /dev/null +++ b/tests/html/1.49.0/log/enum.LevelFilter.html @@ -0,0 +1,79 @@ +log::LevelFilter - Rust

[][src]Enum log::LevelFilter

#[repr(usize)]pub enum LevelFilter {
+    Off,
+    Error,
+    Warn,
+    Info,
+    Debug,
+    Trace,
+}

An enum representing the available verbosity level filters of the logger.

+

A LevelFilter may be compared directly to a Level. Use this type +to get and set the maximum log level with max_level() and set_max_level.

+

+ Variants

+
Off

A level lower than all log levels.

+
Error

Corresponds to the Error log level.

+
Warn

Corresponds to the Warn log level.

+
Info

Corresponds to the Info log level.

+
Debug

Corresponds to the Debug log level.

+
Trace

Corresponds to the Trace log level.

+

Implementations

impl LevelFilter[src]

pub fn max() -> LevelFilter[src]

Returns the most verbose logging level filter.

+

pub fn to_level(&self) -> Option<Level>[src]

Converts self to the equivalent Level.

+

Returns None if self is LevelFilter::Off.

+

Trait Implementations

impl Clone for LevelFilter[src]

impl Copy for LevelFilter[src]

impl Debug for LevelFilter[src]

impl Display for LevelFilter[src]

impl Eq for LevelFilter[src]

impl FromStr for LevelFilter[src]

type Err = ParseLevelError

The associated error which can be returned from parsing.

+

impl Hash for LevelFilter[src]

impl Ord for LevelFilter[src]

impl PartialEq<Level> for LevelFilter[src]

impl PartialEq<LevelFilter> for Level[src]

impl PartialEq<LevelFilter> for LevelFilter[src]

impl PartialOrd<Level> for LevelFilter[src]

impl PartialOrd<LevelFilter> for Level[src]

impl PartialOrd<LevelFilter> for LevelFilter[src]

impl StructuralEq for LevelFilter[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.logger.html b/tests/html/1.49.0/log/fn.logger.html new file mode 100644 index 0000000..62fdf91 --- /dev/null +++ b/tests/html/1.49.0/log/fn.logger.html @@ -0,0 +1,4 @@ +log::logger - Rust

[][src]Function log::logger

pub fn logger() -> &'static dyn Log

Returns a reference to the logger.

+

If a logger has not been set, a no-op implementation is returned.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.max_level.html b/tests/html/1.49.0/log/fn.max_level.html new file mode 100644 index 0000000..d75087f --- /dev/null +++ b/tests/html/1.49.0/log/fn.max_level.html @@ -0,0 +1,6 @@ +log::max_level - Rust

[][src]Function log::max_level

pub fn max_level() -> LevelFilter

Returns the current maximum log level.

+

The log!, error!, warn!, info!, debug!, and trace! macros check +this value and discard any message logged at a higher level. The maximum +log level is set by the set_max_level function.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.set_boxed_logger.html b/tests/html/1.49.0/log/fn.set_boxed_logger.html new file mode 100644 index 0000000..675bf65 --- /dev/null +++ b/tests/html/1.49.0/log/fn.set_boxed_logger.html @@ -0,0 +1,9 @@ +log::set_boxed_logger - Rust

[][src]Function log::set_boxed_logger

pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError>

Sets the global logger to a Box<Log>.

+

This is a simple convenience wrapper over set_logger, which takes a +Box<Log> rather than a &'static Log. See the documentation for +set_logger for more details.

+

Requires the std feature.

+

Errors

+

An error is returned if a logger has already been set.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.set_logger.html b/tests/html/1.49.0/log/fn.set_logger.html new file mode 100644 index 0000000..b3c9632 --- /dev/null +++ b/tests/html/1.49.0/log/fn.set_logger.html @@ -0,0 +1,42 @@ +log::set_logger - Rust

[][src]Function log::set_logger

pub fn set_logger(logger: &'static dyn Log) -> Result<(), SetLoggerError>

Sets the global logger to a &'static Log.

+

This function may only be called once in the lifetime of a program. Any log +events that occur before the call to set_logger completes will be ignored.

+

This function does not typically need to be called manually. Logger +implementations should provide an initialization method that installs the +logger internally.

+

Availability

+

This method is available even when the std feature is disabled. However, +it is currently unavailable on thumbv6 targets, which lack support for +some atomic operations which are used by this function. Even on those +targets, set_logger_racy will be available.

+

Errors

+

An error is returned if a logger has already been set.

+

Examples

+
This code runs with edition 2018
+use log::{error, info, warn, Record, Level, Metadata, LevelFilter};
+
+static MY_LOGGER: MyLogger = MyLogger;
+
+struct MyLogger;
+
+impl log::Log for MyLogger {
+    fn enabled(&self, metadata: &Metadata) -> bool {
+        metadata.level() <= Level::Info
+    }
+
+    fn log(&self, record: &Record) {
+        if self.enabled(record.metadata()) {
+            println!("{} - {}", record.level(), record.args());
+        }
+    }
+    fn flush(&self) {}
+}
+
+log::set_logger(&MY_LOGGER).unwrap();
+log::set_max_level(LevelFilter::Info);
+
+info!("hello log");
+warn!("warning");
+error!("oops");
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.set_logger_racy.html b/tests/html/1.49.0/log/fn.set_logger_racy.html new file mode 100644 index 0000000..babc119 --- /dev/null +++ b/tests/html/1.49.0/log/fn.set_logger_racy.html @@ -0,0 +1,13 @@ +log::set_logger_racy - Rust

[][src]Function log::set_logger_racy

pub unsafe fn set_logger_racy(
    logger: &'static dyn Log
) -> Result<(), SetLoggerError>

A thread-unsafe version of set_logger.

+

This function is available on all platforms, even those that do not have +support for atomics that is needed by set_logger.

+

In almost all cases, set_logger should be preferred.

+

Safety

+

This function is only safe to call when no other logger initialization +function is called while this function still executes.

+

This can be upheld by (for example) making sure that there are no other +threads, and (on embedded) that interrupts are disabled.

+

It is safe to use other logging functions while this function runs +(including all logging macros).

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/fn.set_max_level.html b/tests/html/1.49.0/log/fn.set_max_level.html new file mode 100644 index 0000000..a1c4865 --- /dev/null +++ b/tests/html/1.49.0/log/fn.set_max_level.html @@ -0,0 +1,4 @@ +log::set_max_level - Rust

[][src]Function log::set_max_level

pub fn set_max_level(level: LevelFilter)

Sets the global maximum log level.

+

Generally, this should only be called by the active logging implementation.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/index.html b/tests/html/1.49.0/log/index.html new file mode 100644 index 0000000..4e7c5c7 --- /dev/null +++ b/tests/html/1.49.0/log/index.html @@ -0,0 +1,212 @@ +log - Rust

[][src]Crate log

A lightweight logging facade.

+

The log crate provides a single logging API that abstracts over the +actual logging implementation. Libraries can use the logging API provided +by this crate, and the consumer of those libraries can choose the logging +implementation that is most suitable for its use case.

+

If no logging implementation is selected, the facade falls back to a "noop" +implementation that ignores all log messages. The overhead in this case +is very small - just an integer load, comparison and jump.

+

A log request consists of a target, a level, and a body. A target is a +string which defaults to the module path of the location of the log request, +though that default may be overridden. Logger implementations typically use +the target to filter requests based on some user configuration.

+

Use

+

The basic use of the log crate is through the five logging macros: error!, +warn!, info!, debug! and trace! +where error! represents the highest-priority log messages +and trace! the lowest. The log messages are filtered by configuring +the log level to exclude messages with a lower priority. +Each of these macros accept format strings similarly to println!.

+

In libraries

+

Libraries should link only to the log crate, and use the provided +macros to log whatever information will be useful to downstream consumers.

+

Examples

+
This code runs with edition 2018
+use log::{info, warn};
+
+pub fn shave_the_yak(yak: &mut Yak) {
+    info!(target: "yak_events", "Commencing yak shaving for {:?}", yak);
+
+    loop {
+        match find_a_razor() {
+            Ok(razor) => {
+                info!("Razor located: {}", razor);
+                yak.shave(razor);
+                break;
+            }
+            Err(err) => {
+                warn!("Unable to locate a razor: {}, retrying", err);
+            }
+        }
+    }
+}
+

In executables

+

Executables should choose a logging implementation and initialize it early in the +runtime of the program. Logging implementations will typically include a +function to do this. Any log messages generated before +the implementation is initialized will be ignored.

+

The executable itself may use the log crate to log as well.

+

Warning

+

The logging system may only be initialized once.

+

Available logging implementations

+

In order to produce log output executables have to use +a logger implementation compatible with the facade. +There are many available implementations to choose from, +here are some of the most popular ones:

+ +

Implementing a Logger

+

Loggers implement the Log trait. Here's a very basic example that simply +logs all messages at the Error, Warn or +Info levels to stdout:

+ +
This code runs with edition 2018
+use log::{Record, Level, Metadata};
+
+struct SimpleLogger;
+
+impl log::Log for SimpleLogger {
+    fn enabled(&self, metadata: &Metadata) -> bool {
+        metadata.level() <= Level::Info
+    }
+
+    fn log(&self, record: &Record) {
+        if self.enabled(record.metadata()) {
+            println!("{} - {}", record.level(), record.args());
+        }
+    }
+
+    fn flush(&self) {}
+}
+
+

Loggers are installed by calling the set_logger function. The maximum +log level also needs to be adjusted via the set_max_level function. The +logging facade uses this as an optimization to improve performance of log +messages at levels that are disabled. It's important to set it, as it +defaults to Off, so no log messages will ever be captured! +In the case of our example logger, we'll want to set the maximum log level +to Info, since we ignore any Debug or +Trace level log messages. A logging implementation should +provide a function that wraps a call to set_logger and +set_max_level, handling initialization of the logger:

+ +
This code runs with edition 2018
+use log::{SetLoggerError, LevelFilter};
+
+static LOGGER: SimpleLogger = SimpleLogger;
+
+pub fn init() -> Result<(), SetLoggerError> {
+    log::set_logger(&LOGGER)
+        .map(|()| log::set_max_level(LevelFilter::Info))
+}
+

Implementations that adjust their configurations at runtime should take care +to adjust the maximum log level as well.

+

Use with std

+

set_logger requires you to provide a &'static Log, which can be hard to +obtain if your logger depends on some runtime configuration. The +set_boxed_logger function is available with the std Cargo feature. It is +identical to set_logger except that it takes a Box<Log> rather than a +&'static Log:

+ +
This code runs with edition 2018
+pub fn init() -> Result<(), SetLoggerError> {
+    log::set_boxed_logger(Box::new(SimpleLogger))
+        .map(|()| log::set_max_level(LevelFilter::Info))
+}
+

Compile time filters

+

Log levels can be statically disabled at compile time via Cargo features. Log invocations at +disabled levels will be skipped and will not even be present in the resulting binary. +This level is configured separately for release and debug builds. The features are:

+
    +
  • max_level_off
  • +
  • max_level_error
  • +
  • max_level_warn
  • +
  • max_level_info
  • +
  • max_level_debug
  • +
  • max_level_trace
  • +
  • release_max_level_off
  • +
  • release_max_level_error
  • +
  • release_max_level_warn
  • +
  • release_max_level_info
  • +
  • release_max_level_debug
  • +
  • release_max_level_trace
  • +
+

These features control the value of the STATIC_MAX_LEVEL constant. The logging macros check +this value before logging a message. By default, no levels are disabled.

+

Libraries should avoid using the max level features because they're global and can't be changed +once they're set.

+

For example, a crate can disable trace level logs in debug builds and trace, debug, and info +level logs in release builds with the following configuration:

+
[dependencies]
+log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }
+
+

Crate Feature Flags

+

The following crate feature flags are available in addition to the filters. They are +configured in your Cargo.toml.

+
    +
  • std allows use of std crate instead of the default core. Enables using std::error and +set_boxed_logger functionality.
  • +
  • serde enables support for serialization and deserialization of Level and LevelFilter.
  • +
+
[dependencies]
+log = { version = "0.4", features = ["std", "serde"] }
+
+

Version compatibility

+

The 0.3 and 0.4 versions of the log crate are almost entirely compatible. Log messages +made using log 0.3 will forward transparently to a logger implementation using log 0.4. Log +messages made using log 0.4 will forward to a logger implementation using log 0.3, but the +module path and file name information associated with the message will unfortunately be lost.

+

Macros

+
debug

Logs a message at the debug level.

+
error

Logs a message at the error level.

+
info

Logs a message at the info level.

+
log

The standard logging macro.

+
log_enabled

Determines if a message logged at the specified level in that module will +be logged.

+
trace

Logs a message at the trace level.

+
warn

Logs a message at the warn level.

+

Structs

+
Metadata

Metadata about a log message.

+
MetadataBuilder

Builder for Metadata.

+
ParseLevelError

The type returned by from_str when the string doesn't match any of the log levels.

+
Record

The "payload" of a log message.

+
RecordBuilder

Builder for Record.

+
SetLoggerError

The type returned by set_logger if set_logger has already been called.

+

Enums

+
Level

An enum representing the available verbosity levels of the logger.

+
LevelFilter

An enum representing the available verbosity level filters of the logger.

+

Constants

+
STATIC_MAX_LEVEL

The statically resolved maximum log level.

+

Traits

+
Log

A trait encapsulating the operations required of a logger.

+

Functions

+
logger

Returns a reference to the logger.

+
max_level

Returns the current maximum log level.

+
set_boxed_logger

Sets the global logger to a Box<Log>.

+
set_logger

Sets the global logger to a &'static Log.

+
set_logger_racy

A thread-unsafe version of set_logger.

+
set_max_level

Sets the global maximum log level.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.debug!.html b/tests/html/1.49.0/log/macro.debug!.html new file mode 100644 index 0000000..faa474c --- /dev/null +++ b/tests/html/1.49.0/log/macro.debug!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.debug.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.debug.html b/tests/html/1.49.0/log/macro.debug.html new file mode 100644 index 0000000..d43692c --- /dev/null +++ b/tests/html/1.49.0/log/macro.debug.html @@ -0,0 +1,16 @@ +log::debug - Rust

[][src]Macro log::debug

+macro_rules! debug {
+    (target: $target:expr, $($arg:tt)+) => { ... };
+    ($($arg:tt)+) => { ... };
+}
+

Logs a message at the debug level.

+

Examples

+
This code runs with edition 2018
+use log::debug;
+
+let pos = Position { x: 3.234, y: -1.223 };
+
+debug!("New position: x: {}, y: {}", pos.x, pos.y);
+debug!(target: "app_events", "New position: x: {}, y: {}", pos.x, pos.y);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.error!.html b/tests/html/1.49.0/log/macro.error!.html new file mode 100644 index 0000000..e24b748 --- /dev/null +++ b/tests/html/1.49.0/log/macro.error!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.error.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.error.html b/tests/html/1.49.0/log/macro.error.html new file mode 100644 index 0000000..689778d --- /dev/null +++ b/tests/html/1.49.0/log/macro.error.html @@ -0,0 +1,16 @@ +log::error - Rust

[][src]Macro log::error

+macro_rules! error {
+    (target: $target:expr, $($arg:tt)+) => { ... };
+    ($($arg:tt)+) => { ... };
+}
+

Logs a message at the error level.

+

Examples

+
This code runs with edition 2018
+use log::error;
+
+let (err_info, port) = ("No connection", 22);
+
+error!("Error: {} on port {}", err_info, port);
+error!(target: "app_events", "App Error: {}, Port: {}", err_info, 22);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.info!.html b/tests/html/1.49.0/log/macro.info!.html new file mode 100644 index 0000000..5bad5c4 --- /dev/null +++ b/tests/html/1.49.0/log/macro.info!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.info.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.info.html b/tests/html/1.49.0/log/macro.info.html new file mode 100644 index 0000000..72f171f --- /dev/null +++ b/tests/html/1.49.0/log/macro.info.html @@ -0,0 +1,17 @@ +log::info - Rust

[][src]Macro log::info

+macro_rules! info {
+    (target: $target:expr, $($arg:tt)+) => { ... };
+    ($($arg:tt)+) => { ... };
+}
+

Logs a message at the info level.

+

Examples

+
This code runs with edition 2018
+use log::info;
+
+let conn_info = Connection { port: 40, speed: 3.20 };
+
+info!("Connected to port {} at {} Mb/s", conn_info.port, conn_info.speed);
+info!(target: "connection_events", "Successfull connection, port: {}, speed: {}",
+      conn_info.port, conn_info.speed);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.log!.html b/tests/html/1.49.0/log/macro.log!.html new file mode 100644 index 0000000..7ff1ced --- /dev/null +++ b/tests/html/1.49.0/log/macro.log!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.log.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.log.html b/tests/html/1.49.0/log/macro.log.html new file mode 100644 index 0000000..befdeec --- /dev/null +++ b/tests/html/1.49.0/log/macro.log.html @@ -0,0 +1,21 @@ +log::log - Rust

[][src]Macro log::log

+macro_rules! log {
+    (target: $target:expr, $lvl:expr, $message:expr) => { ... };
+    (target: $target:expr, $lvl:expr, $($arg:tt)+) => { ... };
+    ($lvl:expr, $($arg:tt)+) => { ... };
+}
+

The standard logging macro.

+

This macro will generically log with the specified Level and format! +based argument list.

+

Examples

+
This code runs with edition 2018
+use log::{log, Level};
+
+let data = (42, "Forty-two");
+let private_data = "private";
+
+log!(Level::Error, "Received errors: {}, {}", data.0, data.1);
+log!(target: "app_events", Level::Warn, "App warning: {}, {}, {}",
+    data.0, data.1, private_data);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.log_enabled!.html b/tests/html/1.49.0/log/macro.log_enabled!.html new file mode 100644 index 0000000..2731fd3 --- /dev/null +++ b/tests/html/1.49.0/log/macro.log_enabled!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.log_enabled.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.log_enabled.html b/tests/html/1.49.0/log/macro.log_enabled.html new file mode 100644 index 0000000..e895af8 --- /dev/null +++ b/tests/html/1.49.0/log/macro.log_enabled.html @@ -0,0 +1,24 @@ +log::log_enabled - Rust

[][src]Macro log::log_enabled

+macro_rules! log_enabled {
+    (target: $target:expr, $lvl:expr) => { ... };
+    ($lvl:expr) => { ... };
+}
+

Determines if a message logged at the specified level in that module will +be logged.

+

This can be used to avoid expensive computation of log message arguments if +the message would be ignored anyway.

+

Examples

+
This code runs with edition 2018
+use log::Level::Debug;
+use log::{debug, log_enabled};
+
+if log_enabled!(Debug) {
+    let data = expensive_call();
+    debug!("expensive debug data: {} {}", data.x, data.y);
+}
+if log_enabled!(target: "Global", Debug) {
+   let data = expensive_call();
+   debug!(target: "Global", "expensive debug data: {} {}", data.x, data.y);
+}
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.trace!.html b/tests/html/1.49.0/log/macro.trace!.html new file mode 100644 index 0000000..68417a7 --- /dev/null +++ b/tests/html/1.49.0/log/macro.trace!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.trace.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.trace.html b/tests/html/1.49.0/log/macro.trace.html new file mode 100644 index 0000000..0c288c2 --- /dev/null +++ b/tests/html/1.49.0/log/macro.trace.html @@ -0,0 +1,18 @@ +log::trace - Rust

[][src]Macro log::trace

+macro_rules! trace {
+    (target: $target:expr, $($arg:tt)+) => { ... };
+    ($($arg:tt)+) => { ... };
+}
+

Logs a message at the trace level.

+

Examples

+
This code runs with edition 2018
+use log::trace;
+
+let pos = Position { x: 3.234, y: -1.223 };
+
+trace!("Position is: x: {}, y: {}", pos.x, pos.y);
+trace!(target: "app_events", "x is {} and y is {}",
+       if pos.x >= 0.0 { "positive" } else { "negative" },
+       if pos.y >= 0.0 { "positive" } else { "negative" });
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.warn!.html b/tests/html/1.49.0/log/macro.warn!.html new file mode 100644 index 0000000..70d3235 --- /dev/null +++ b/tests/html/1.49.0/log/macro.warn!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.warn.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/log/macro.warn.html b/tests/html/1.49.0/log/macro.warn.html new file mode 100644 index 0000000..4658330 --- /dev/null +++ b/tests/html/1.49.0/log/macro.warn.html @@ -0,0 +1,16 @@ +log::warn - Rust

[][src]Macro log::warn

+macro_rules! warn {
+    (target: $target:expr, $($arg:tt)+) => { ... };
+    ($($arg:tt)+) => { ... };
+}
+

Logs a message at the warn level.

+

Examples

+
This code runs with edition 2018
+use log::warn;
+
+let warn_description = "Invalid Input";
+
+warn!("Warning! {}!", warn_description);
+warn!(target: "input_events", "App received warning: {}", warn_description);
+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/sidebar-items.js b/tests/html/1.49.0/log/sidebar-items.js new file mode 100644 index 0000000..777cf8e --- /dev/null +++ b/tests/html/1.49.0/log/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["STATIC_MAX_LEVEL","The statically resolved maximum log level."]],"enum":[["Level","An enum representing the available verbosity levels of the logger."],["LevelFilter","An enum representing the available verbosity level filters of the logger."]],"fn":[["logger","Returns a reference to the logger."],["max_level","Returns the current maximum log level."],["set_boxed_logger","Sets the global logger to a `Box`."],["set_logger","Sets the global logger to a `&'static Log`."],["set_logger_racy","A thread-unsafe version of `set_logger`."],["set_max_level","Sets the global maximum log level."]],"macro":[["debug","Logs a message at the debug level."],["error","Logs a message at the error level."],["info","Logs a message at the info level."],["log","The standard logging macro."],["log_enabled","Determines if a message logged at the specified level in that module will be logged."],["trace","Logs a message at the trace level."],["warn","Logs a message at the warn level."]],"struct":[["Metadata","Metadata about a log message."],["MetadataBuilder","Builder for `Metadata`."],["ParseLevelError","The type returned by `from_str` when the string doesn't match any of the log levels."],["Record","The \"payload\" of a log message."],["RecordBuilder","Builder for `Record`."],["SetLoggerError","The type returned by `set_logger` if `set_logger` has already been called."]],"trait":[["Log","A trait encapsulating the operations required of a logger."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.Metadata.html b/tests/html/1.49.0/log/struct.Metadata.html new file mode 100644 index 0000000..4d92904 --- /dev/null +++ b/tests/html/1.49.0/log/struct.Metadata.html @@ -0,0 +1,66 @@ +log::Metadata - Rust

[][src]Struct log::Metadata

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

Metadata about a log message.

+

Use

+

Metadata structs are created when users of the library use +logging macros.

+

They are consumed by implementations of the Log trait in the +enabled method.

+

Records use Metadata to determine the log message's severity +and target.

+

Users should use the log_enabled! macro in their code to avoid +constructing expensive log messages.

+

Examples

+
This code runs with edition 2018
+use log::{Record, Level, Metadata};
+
+struct MyLogger;
+
+impl log::Log for MyLogger {
+    fn enabled(&self, metadata: &Metadata) -> bool {
+        metadata.level() <= Level::Info
+    }
+
+    fn log(&self, record: &Record) {
+        if self.enabled(record.metadata()) {
+            println!("{} - {}", record.level(), record.args());
+        }
+    }
+    fn flush(&self) {}
+}
+
+

Implementations

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

pub fn builder() -> MetadataBuilder<'a>[src]

Returns a new builder.

+

pub fn level(&self) -> Level[src]

The verbosity level of the message.

+

pub fn target(&self) -> &'a str[src]

The name of the target of the directive.

+

Trait Implementations

impl<'a> Clone for Metadata<'a>[src]

impl<'a> Debug for Metadata<'a>[src]

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

impl<'a> Hash for Metadata<'a>[src]

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

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

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

impl<'a> StructuralEq for Metadata<'a>[src]

impl<'a> StructuralPartialEq for Metadata<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Metadata<'a>

impl<'a> Send for Metadata<'a>

impl<'a> Sync for Metadata<'a>

impl<'a> Unpin for Metadata<'a>

impl<'a> UnwindSafe for Metadata<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.MetadataBuilder.html b/tests/html/1.49.0/log/struct.MetadataBuilder.html new file mode 100644 index 0000000..ad1bfe4 --- /dev/null +++ b/tests/html/1.49.0/log/struct.MetadataBuilder.html @@ -0,0 +1,49 @@ +log::MetadataBuilder - Rust

[][src]Struct log::MetadataBuilder

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

Builder for Metadata.

+

Typically should only be used by log library creators or for testing and "shim loggers". +The MetadataBuilder can set the different parameters of a Metadata object, and returns +the created object when build is called.

+

Example

+
This code runs with edition 2018
+let target = "myApp";
+use log::{Level, MetadataBuilder};
+let metadata = MetadataBuilder::new()
+                    .level(Level::Debug)
+                    .target(target)
+                    .build();
+

Implementations

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

pub fn new() -> MetadataBuilder<'a>[src]

Construct a new MetadataBuilder.

+

The default options are:

+
    +
  • level: Level::Info
  • +
  • target: ""
  • +
+

pub fn level(&mut self, arg: Level) -> &mut MetadataBuilder<'a>[src]

Setter for level.

+

pub fn target(&mut self, target: &'a str) -> &mut MetadataBuilder<'a>[src]

Setter for target.

+

pub fn build(&self) -> Metadata<'a>[src]

Returns a Metadata object.

+

Trait Implementations

impl<'a> Debug for MetadataBuilder<'a>[src]

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

impl<'a> Hash for MetadataBuilder<'a>[src]

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

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

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

impl<'a> StructuralEq for MetadataBuilder<'a>[src]

impl<'a> StructuralPartialEq for MetadataBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for MetadataBuilder<'a>

impl<'a> Send for MetadataBuilder<'a>

impl<'a> Sync for MetadataBuilder<'a>

impl<'a> Unpin for MetadataBuilder<'a>

impl<'a> UnwindSafe for MetadataBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.ParseLevelError.html b/tests/html/1.49.0/log/struct.ParseLevelError.html new file mode 100644 index 0000000..f48534c --- /dev/null +++ b/tests/html/1.49.0/log/struct.ParseLevelError.html @@ -0,0 +1,22 @@ +log::ParseLevelError - Rust

[][src]Struct log::ParseLevelError

pub struct ParseLevelError(_);

The type returned by from_str when the string doesn't match any of the log levels.

+

Trait Implementations

impl Debug for ParseLevelError[src]

impl Display for ParseLevelError[src]

impl Error for ParseLevelError[src]

impl PartialEq<ParseLevelError> for ParseLevelError[src]

impl StructuralPartialEq for ParseLevelError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.Record.html b/tests/html/1.49.0/log/struct.Record.html new file mode 100644 index 0000000..9ad8261 --- /dev/null +++ b/tests/html/1.49.0/log/struct.Record.html @@ -0,0 +1,61 @@ +log::Record - Rust

[][src]Struct log::Record

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

The "payload" of a log message.

+

Use

+

Record structures are passed as parameters to the log +method of the Log trait. Logger implementors manipulate these +structures in order to display log messages. Records are automatically +created by the log! macro and so are not seen by log users.

+

Note that the level() and target() accessors are equivalent to +self.metadata().level() and self.metadata().target() respectively. +These methods are provided as a convenience for users of this structure.

+

Example

+

The following example shows a simple logger that displays the level, +module path, and message of any Record that is passed to it.

+ +
This code runs with edition 2018
+struct SimpleLogger;
+
+impl log::Log for SimpleLogger {
+   fn enabled(&self, metadata: &log::Metadata) -> bool {
+       true
+   }
+
+   fn log(&self, record: &log::Record) {
+       if !self.enabled(record.metadata()) {
+           return;
+       }
+
+       println!("{}:{} -- {}",
+                record.level(),
+                record.target(),
+                record.args());
+   }
+   fn flush(&self) {}
+}
+

Implementations

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

pub fn builder() -> RecordBuilder<'a>[src]

Returns a new builder.

+

pub fn args(&self) -> &Arguments<'a>[src]

The message body.

+

pub fn metadata(&self) -> &Metadata<'a>[src]

Metadata about the log directive.

+

pub fn level(&self) -> Level[src]

The verbosity level of the message.

+

pub fn target(&self) -> &'a str[src]

The name of the target of the directive.

+

pub fn module_path(&self) -> Option<&'a str>[src]

The module path of the message.

+

pub fn module_path_static(&self) -> Option<&'static str>[src]

The module path of the message, if it is a 'static string.

+

pub fn file(&self) -> Option<&'a str>[src]

The source file containing the message.

+

pub fn file_static(&self) -> Option<&'static str>[src]

The module path of the message, if it is a 'static string.

+

pub fn line(&self) -> Option<u32>[src]

The line containing the message.

+

Trait Implementations

impl<'a> Clone for Record<'a>[src]

impl<'a> Debug for Record<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Record<'a>

impl<'a> !Send for Record<'a>

impl<'a> !Sync for Record<'a>

impl<'a> Unpin for Record<'a>

impl<'a> !UnwindSafe for Record<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.RecordBuilder.html b/tests/html/1.49.0/log/struct.RecordBuilder.html new file mode 100644 index 0000000..6ae17d9 --- /dev/null +++ b/tests/html/1.49.0/log/struct.RecordBuilder.html @@ -0,0 +1,64 @@ +log::RecordBuilder - Rust

[][src]Struct log::RecordBuilder

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

Builder for Record.

+

Typically should only be used by log library creators or for testing and "shim loggers". +The RecordBuilder can set the different parameters of Record object, and returns +the created object when build is called.

+

Examples

+
This code runs with edition 2018
+use log::{Level, Record};
+
+let record = Record::builder()
+                .args(format_args!("Error!"))
+                .level(Level::Error)
+                .target("myApp")
+                .file(Some("server.rs"))
+                .line(Some(144))
+                .module_path(Some("server"))
+                .build();
+

Alternatively, use MetadataBuilder:

+ +
This code runs with edition 2018
+use log::{Record, Level, MetadataBuilder};
+
+let error_metadata = MetadataBuilder::new()
+                        .target("myApp")
+                        .level(Level::Error)
+                        .build();
+
+let record = Record::builder()
+                .metadata(error_metadata)
+                .args(format_args!("Error!"))
+                .line(Some(433))
+                .file(Some("app.rs"))
+                .module_path(Some("server"))
+                .build();
+

Implementations

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

pub fn new() -> RecordBuilder<'a>[src]

Construct new RecordBuilder.

+

The default options are:

+ +

pub fn args(&mut self, args: Arguments<'a>) -> &mut RecordBuilder<'a>[src]

Set args.

+

pub fn metadata(&mut self, metadata: Metadata<'a>) -> &mut RecordBuilder<'a>[src]

Set metadata. Construct a Metadata object with MetadataBuilder.

+

pub fn level(&mut self, level: Level) -> &mut RecordBuilder<'a>[src]

pub fn target(&mut self, target: &'a str) -> &mut RecordBuilder<'a>[src]

pub fn module_path(&mut self, path: Option<&'a str>) -> &mut RecordBuilder<'a>[src]

pub fn module_path_static(
    &mut self,
    path: Option<&'static str>
) -> &mut RecordBuilder<'a>
[src]

Set module_path to a 'static string

+

pub fn file(&mut self, file: Option<&'a str>) -> &mut RecordBuilder<'a>[src]

Set file

+

pub fn file_static(
    &mut self,
    file: Option<&'static str>
) -> &mut RecordBuilder<'a>
[src]

Set file to a 'static string.

+

pub fn line(&mut self, line: Option<u32>) -> &mut RecordBuilder<'a>[src]

Set line

+

pub fn build(&self) -> Record<'a>[src]

Invoke the builder and return a Record

+

Trait Implementations

impl<'a> Debug for RecordBuilder<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for RecordBuilder<'a>

impl<'a> !Send for RecordBuilder<'a>

impl<'a> !Sync for RecordBuilder<'a>

impl<'a> Unpin for RecordBuilder<'a>

impl<'a> !UnwindSafe for RecordBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/struct.SetLoggerError.html b/tests/html/1.49.0/log/struct.SetLoggerError.html new file mode 100644 index 0000000..7058b89 --- /dev/null +++ b/tests/html/1.49.0/log/struct.SetLoggerError.html @@ -0,0 +1,19 @@ +log::SetLoggerError - Rust

[][src]Struct log::SetLoggerError

pub struct SetLoggerError(_);

The type returned by set_logger if set_logger has already been called.

+

Trait Implementations

impl Debug for SetLoggerError[src]

impl Display for SetLoggerError[src]

impl Error for SetLoggerError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/log/trait.Log.html b/tests/html/1.49.0/log/trait.Log.html new file mode 100644 index 0000000..735b74c --- /dev/null +++ b/tests/html/1.49.0/log/trait.Log.html @@ -0,0 +1,17 @@ +log::Log - Rust

[][src]Trait log::Log

pub trait Log: Sync + Send {
+    fn enabled(&self, metadata: &Metadata<'_>) -> bool;
+
fn log(&self, record: &Record<'_>); +
fn flush(&self); +}

A trait encapsulating the operations required of a logger.

+

Required methods

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be +logged.

+

This is used by the log_enabled! macro to allow callers to avoid +expensive computation of log message arguments if the message would be +discarded anyway.

+

fn log(&self, record: &Record<'_>)

Logs the Record.

+

Note that enabled is not necessarily called before this method. +Implementations of log should perform all necessary filtering +internally.

+

fn flush(&self)

Flushes any buffered records.

+
Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/all.html b/tests/html/1.49.0/rand_core/all.html new file mode 100644 index 0000000..439b961 --- /dev/null +++ b/tests/html/1.49.0/rand_core/all.html @@ -0,0 +1,4 @@ +List of all items in this crate

[] + + List of all items

Structs

Traits

Functions

\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/block/index.html b/tests/html/1.49.0/rand_core/block/index.html new file mode 100644 index 0000000..36051f8 --- /dev/null +++ b/tests/html/1.49.0/rand_core/block/index.html @@ -0,0 +1,48 @@ +rand_core::block - Rust

[][src]Module rand_core::block

The BlockRngCore trait and implementation helpers

+

The BlockRngCore trait exists to assist in the implementation of RNGs +which generate a block of data in a cache instead of returning generated +values directly.

+

Usage of this trait is optional, but provides two advantages: +implementations only need to concern themselves with generation of the +block, not the various RngCore methods (especially fill_bytes, where +the optimal implementations are not trivial), and this allows +ReseedingRng (see rand crate) perform periodic +reseeding with very low overhead.

+

Example

+
use rand_core::block::{BlockRngCore, BlockRng};
+
+struct MyRngCore;
+
+impl BlockRngCore for MyRngCore {
+    type Results = [u32; 16];
+
+    fn generate(&mut self, results: &mut Self::Results) {
+        unimplemented!()
+    }
+}
+
+impl SeedableRng for MyRngCore {
+    type Seed = unimplemented!();
+    fn from_seed(seed: Self::Seed) -> Self {
+        unimplemented!()
+    }
+}
+
+// optionally, also implement CryptoRng for MyRngCore
+
+// Final RNG.
+type MyRng = BlockRng<u32, MyRngCore>;
+
+

Structs

+
BlockRng

A wrapper type implementing RngCore for some type implementing +BlockRngCore with u32 array buffer; i.e. this can be used to implement +a full RNG from just a generate function.

+
BlockRng64

A wrapper type implementing RngCore for some type implementing +BlockRngCore with u64 array buffer; i.e. this can be used to implement +a full RNG from just a generate function.

+

Traits

+
BlockRngCore

A trait for RNGs which do not generate random numbers individually, but in +blocks (typically [u32; N]). This technique is commonly used by +cryptographic RNGs to improve performance.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/block/sidebar-items.js b/tests/html/1.49.0/rand_core/block/sidebar-items.js new file mode 100644 index 0000000..1bc831f --- /dev/null +++ b/tests/html/1.49.0/rand_core/block/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["BlockRng","A wrapper type implementing [`RngCore`] for some type implementing [`BlockRngCore`] with `u32` array buffer; i.e. this can be used to implement a full RNG from just a `generate` function."],["BlockRng64","A wrapper type implementing [`RngCore`] for some type implementing [`BlockRngCore`] with `u64` array buffer; i.e. this can be used to implement a full RNG from just a `generate` function."]],"trait":[["BlockRngCore","A trait for RNGs which do not generate random numbers individually, but in blocks (typically `[u32; N]`). This technique is commonly used by cryptographic RNGs to improve performance."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/block/struct.BlockRng.html b/tests/html/1.49.0/rand_core/block/struct.BlockRng.html new file mode 100644 index 0000000..a92ce25 --- /dev/null +++ b/tests/html/1.49.0/rand_core/block/struct.BlockRng.html @@ -0,0 +1,68 @@ +rand_core::block::BlockRng - Rust

[][src]Struct rand_core::block::BlockRng

pub struct BlockRng<R: BlockRngCore + ?Sized> {
+    pub core: R,
+    // some fields omitted
+}

A wrapper type implementing RngCore for some type implementing +BlockRngCore with u32 array buffer; i.e. this can be used to implement +a full RNG from just a generate function.

+

The core field may be accessed directly but the results buffer may not. +PRNG implementations can simply use a type alias +(pub type MyRng = BlockRng<MyRngCore>;) but might prefer to use a +wrapper type (pub struct MyRng(BlockRng<MyRngCore>);); the latter must +re-implement RngCore but hides the implementation details and allows +extra functionality to be defined on the RNG +(e.g. impl MyRng { fn set_stream(...){...} }).

+

BlockRng has heavily optimized implementations of the RngCore methods +reading values from the results buffer, as well as +calling BlockRngCore::generate directly on the output array when +fill_bytes / try_fill_bytes is called on a large array. These methods +also handle the bookkeeping of when to generate a new batch of values.

+

No whole generated u32 values are thown away and all values are consumed +in-order. next_u32 simply takes the next available u32 value. +next_u64 is implemented by combining two u32 values, least +significant first. fill_bytes and try_fill_bytes consume a whole +number of u32 values, converting each u32 to a byte slice in +little-endian order. If the requested byte length is not a multiple of 4, +some bytes will be discarded.

+

See also BlockRng64 which uses u64 array buffers. Currently there is +no direct support for other buffer types.

+

For easy initialization BlockRng also implements SeedableRng.

+

+ Fields

core: R

The core part of the RNG, implementing the generate function.

+

Implementations

impl<R: BlockRngCore> BlockRng<R>[src]

pub fn new(core: R) -> BlockRng<R>[src]

Create a new BlockRng from an existing RNG implementing +BlockRngCore. Results will be generated on first use.

+

pub fn index(&self) -> usize[src]

Get the index into the result buffer.

+

If this is equal to or larger than the size of the result buffer then +the buffer is "empty" and generate() must be called to produce new +results.

+

pub fn reset(&mut self)[src]

Reset the number of available results. +This will force a new set of results to be generated on next use.

+

pub fn generate_and_set(&mut self, index: usize)[src]

Generate a new set of results immediately, setting the index to the +given value.

+

Trait Implementations

impl<R: Clone + BlockRngCore + ?Sized> Clone for BlockRng<R> where
    R::Results: Clone
[src]

impl<R: BlockRngCore + CryptoRng> CryptoRng for BlockRng<R>[src]

impl<R: BlockRngCore + Debug> Debug for BlockRng<R>[src]

impl<R: BlockRngCore<Item = u32>> RngCore for BlockRng<R> where
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng<R>[src]

type Seed = R::Seed

Seed type, which is restricted to types mutably-dereferencable as u8 +arrays (we recommend [u8; N] for some N). Read more

+

Auto Trait Implementations

impl<R: ?Sized> RefUnwindSafe for BlockRng<R> where
    R: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe

impl<R: ?Sized> Send for BlockRng<R> where
    R: Send,
    <R as BlockRngCore>::Results: Send

impl<R: ?Sized> Sync for BlockRng<R> where
    R: Sync,
    <R as BlockRngCore>::Results: Sync

impl<R: ?Sized> Unpin for BlockRng<R> where
    R: Unpin,
    <R as BlockRngCore>::Results: Unpin

impl<R: ?Sized> UnwindSafe for BlockRng<R> where
    R: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/block/struct.BlockRng64.html b/tests/html/1.49.0/rand_core/block/struct.BlockRng64.html new file mode 100644 index 0000000..0673999 --- /dev/null +++ b/tests/html/1.49.0/rand_core/block/struct.BlockRng64.html @@ -0,0 +1,57 @@ +rand_core::block::BlockRng64 - Rust

[][src]Struct rand_core::block::BlockRng64

pub struct BlockRng64<R: BlockRngCore + ?Sized> {
+    pub core: R,
+    // some fields omitted
+}

A wrapper type implementing RngCore for some type implementing +BlockRngCore with u64 array buffer; i.e. this can be used to implement +a full RNG from just a generate function.

+

This is similar to BlockRng, but specialized for algorithms that operate +on u64 values.

+

No whole generated u64 values are thrown away and all values are consumed +in-order. next_u64 simply takes the next available u64 value. +next_u32 is however a bit special: half of a u64 is consumed, leaving +the other half in the buffer. If the next function called is next_u32 +then the other half is then consumed, however both next_u64 and +fill_bytes discard the rest of any half-consumed u64s when called.

+

fill_bytes and try_fill_bytes consume a whole number of u64 +values. If the requested length is not a multiple of 8, some bytes will be +discarded.

+

+ Fields

core: R

The core part of the RNG, implementing the generate function.

+

Implementations

impl<R: BlockRngCore> BlockRng64<R>[src]

pub fn new(core: R) -> BlockRng64<R>[src]

Create a new BlockRng from an existing RNG implementing +BlockRngCore. Results will be generated on first use.

+

pub fn index(&self) -> usize[src]

Get the index into the result buffer.

+

If this is equal to or larger than the size of the result buffer then +the buffer is "empty" and generate() must be called to produce new +results.

+

pub fn reset(&mut self)[src]

Reset the number of available results. +This will force a new set of results to be generated on next use.

+

pub fn generate_and_set(&mut self, index: usize)[src]

Generate a new set of results immediately, setting the index to the +given value.

+

Trait Implementations

impl<R: Clone + BlockRngCore + ?Sized> Clone for BlockRng64<R> where
    R::Results: Clone
[src]

impl<R: BlockRngCore + Debug> Debug for BlockRng64<R>[src]

impl<R: BlockRngCore<Item = u64>> RngCore for BlockRng64<R> where
    <R as BlockRngCore>::Results: AsRef<[u64]> + AsMut<[u64]>, 
[src]

impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng64<R>[src]

type Seed = R::Seed

Seed type, which is restricted to types mutably-dereferencable as u8 +arrays (we recommend [u8; N] for some N). Read more

+

Auto Trait Implementations

impl<R: ?Sized> RefUnwindSafe for BlockRng64<R> where
    R: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe

impl<R: ?Sized> Send for BlockRng64<R> where
    R: Send,
    <R as BlockRngCore>::Results: Send

impl<R: ?Sized> Sync for BlockRng64<R> where
    R: Sync,
    <R as BlockRngCore>::Results: Sync

impl<R: ?Sized> Unpin for BlockRng64<R> where
    R: Unpin,
    <R as BlockRngCore>::Results: Unpin

impl<R: ?Sized> UnwindSafe for BlockRng64<R> where
    R: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/block/trait.BlockRngCore.html b/tests/html/1.49.0/rand_core/block/trait.BlockRngCore.html new file mode 100644 index 0000000..0900b6f --- /dev/null +++ b/tests/html/1.49.0/rand_core/block/trait.BlockRngCore.html @@ -0,0 +1,14 @@ +rand_core::block::BlockRngCore - Rust

[][src]Trait rand_core::block::BlockRngCore

pub trait BlockRngCore {
+    type Item;
+    type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default;
+    fn generate(&mut self, results: &mut Self::Results);
+}

A trait for RNGs which do not generate random numbers individually, but in +blocks (typically [u32; N]). This technique is commonly used by +cryptographic RNGs to improve performance.

+

See the module documentation for details.

+

Associated Types

type Item

Results element type, e.g. u32.

+

type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default

Results type. This is the 'block' an RNG implementing BlockRngCore +generates, which will usually be an array like [u32; 16].

+
Loading content...

Required methods

fn generate(&mut self, results: &mut Self::Results)

Generate a new block of results.

+
Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/error/struct.Error.html b/tests/html/1.49.0/rand_core/error/struct.Error.html new file mode 100644 index 0000000..3cf4623 --- /dev/null +++ b/tests/html/1.49.0/rand_core/error/struct.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../rand_core/struct.Error.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.fill_bytes_via_next.html b/tests/html/1.49.0/rand_core/impls/fn.fill_bytes_via_next.html new file mode 100644 index 0000000..329267b --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.fill_bytes_via_next.html @@ -0,0 +1,7 @@ +rand_core::impls::fill_bytes_via_next - Rust

[][src]Function rand_core::impls::fill_bytes_via_next

pub fn fill_bytes_via_next<R: RngCore + ?Sized>(rng: &mut R, dest: &mut [u8])

Implement fill_bytes via next_u64 and next_u32, little-endian order.

+

The fastest way to fill a slice is usually to work as long as possible with +integers. That is why this method mostly uses next_u64, and only when +there are 4 or less bytes remaining at the end of the slice it uses +next_u32 once.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.fill_via_u32_chunks.html b/tests/html/1.49.0/rand_core/impls/fn.fill_via_u32_chunks.html new file mode 100644 index 0000000..cc3db55 --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.fill_via_u32_chunks.html @@ -0,0 +1,28 @@ +rand_core::impls::fill_via_u32_chunks - Rust

[][src]Function rand_core::impls::fill_via_u32_chunks

pub fn fill_via_u32_chunks(src: &[u32], dest: &mut [u8]) -> (usize, usize)

Implement fill_bytes by reading chunks from the output buffer of a block +based RNG.

+

The return values are (consumed_u32, filled_u8).

+

filled_u8 is the number of filled bytes in dest, which may be less than +the length of dest. +consumed_u32 is the number of words consumed from src, which is the same +as filled_u8 / 4 rounded up.

+

Example

+

(from IsaacRng)

+ +
This example is not tested
+fn fill_bytes(&mut self, dest: &mut [u8]) {
+    let mut read_len = 0;
+    while read_len < dest.len() {
+        if self.index >= self.rsl.len() {
+            self.isaac();
+        }
+
+        let (consumed_u32, filled_u8) =
+            impls::fill_via_u32_chunks(&mut self.rsl[self.index..],
+                                       &mut dest[read_len..]);
+
+        self.index += consumed_u32;
+        read_len += filled_u8;
+    }
+}
+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.fill_via_u64_chunks.html b/tests/html/1.49.0/rand_core/impls/fn.fill_via_u64_chunks.html new file mode 100644 index 0000000..4c0c21a --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.fill_via_u64_chunks.html @@ -0,0 +1,10 @@ +rand_core::impls::fill_via_u64_chunks - Rust

[][src]Function rand_core::impls::fill_via_u64_chunks

pub fn fill_via_u64_chunks(src: &[u64], dest: &mut [u8]) -> (usize, usize)

Implement fill_bytes by reading chunks from the output buffer of a block +based RNG.

+

The return values are (consumed_u64, filled_u8). +filled_u8 is the number of filled bytes in dest, which may be less than +the length of dest. +consumed_u64 is the number of words consumed from src, which is the same +as filled_u8 / 8 rounded up.

+

See fill_via_u32_chunks for an example.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.next_u32_via_fill.html b/tests/html/1.49.0/rand_core/impls/fn.next_u32_via_fill.html new file mode 100644 index 0000000..3e5c371 --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.next_u32_via_fill.html @@ -0,0 +1,3 @@ +rand_core::impls::next_u32_via_fill - Rust

[][src]Function rand_core::impls::next_u32_via_fill

pub fn next_u32_via_fill<R: RngCore + ?Sized>(rng: &mut R) -> u32

Implement next_u32 via fill_bytes, little-endian order.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_fill.html b/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_fill.html new file mode 100644 index 0000000..452fa04 --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_fill.html @@ -0,0 +1,3 @@ +rand_core::impls::next_u64_via_fill - Rust

[][src]Function rand_core::impls::next_u64_via_fill

pub fn next_u64_via_fill<R: RngCore + ?Sized>(rng: &mut R) -> u64

Implement next_u64 via fill_bytes, little-endian order.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_u32.html b/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_u32.html new file mode 100644 index 0000000..7e29fca --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/fn.next_u64_via_u32.html @@ -0,0 +1,3 @@ +rand_core::impls::next_u64_via_u32 - Rust

[][src]Function rand_core::impls::next_u64_via_u32

pub fn next_u64_via_u32<R: RngCore + ?Sized>(rng: &mut R) -> u64

Implement next_u64 via next_u32, little-endian order.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/index.html b/tests/html/1.49.0/rand_core/impls/index.html new file mode 100644 index 0000000..4f03502 --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/index.html @@ -0,0 +1,19 @@ +rand_core::impls - Rust

[][src]Module rand_core::impls

Helper functions for implementing RngCore functions.

+

For cross-platform reproducibility, these functions all use Little Endian: +least-significant part first. For example, next_u64_via_u32 takes u32 +values x, y, then outputs (y << 32) | x. To implement next_u32 +from next_u64 in little-endian order, one should use next_u64() as u32.

+

Byte-swapping (like the std to_le functions) is only needed to convert +to/from byte sequences, and since its purpose is reproducibility, +non-reproducible sources (e.g. OsRng) need not bother with it.

+

Functions

+
fill_bytes_via_next

Implement fill_bytes via next_u64 and next_u32, little-endian order.

+
fill_via_u32_chunks

Implement fill_bytes by reading chunks from the output buffer of a block +based RNG.

+
fill_via_u64_chunks

Implement fill_bytes by reading chunks from the output buffer of a block +based RNG.

+
next_u32_via_fill

Implement next_u32 via fill_bytes, little-endian order.

+
next_u64_via_fill

Implement next_u64 via fill_bytes, little-endian order.

+
next_u64_via_u32

Implement next_u64 via next_u32, little-endian order.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/impls/sidebar-items.js b/tests/html/1.49.0/rand_core/impls/sidebar-items.js new file mode 100644 index 0000000..ac2123c --- /dev/null +++ b/tests/html/1.49.0/rand_core/impls/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["fill_bytes_via_next","Implement `fill_bytes` via `next_u64` and `next_u32`, little-endian order."],["fill_via_u32_chunks","Implement `fill_bytes` by reading chunks from the output buffer of a block based RNG."],["fill_via_u64_chunks","Implement `fill_bytes` by reading chunks from the output buffer of a block based RNG."],["next_u32_via_fill","Implement `next_u32` via `fill_bytes`, little-endian order."],["next_u64_via_fill","Implement `next_u64` via `fill_bytes`, little-endian order."],["next_u64_via_u32","Implement `next_u64` via `next_u32`, little-endian order."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/index.html b/tests/html/1.49.0/rand_core/index.html new file mode 100644 index 0000000..348c68d --- /dev/null +++ b/tests/html/1.49.0/rand_core/index.html @@ -0,0 +1,27 @@ +rand_core - Rust

[][src]Crate rand_core

Random number generation traits

+

This crate is mainly of interest to crates publishing implementations of +RngCore. Other users are encouraged to use the rand crate instead +which re-exports the main traits and error types.

+

RngCore is the core trait implemented by algorithmic pseudo-random number +generators and external random-number sources.

+

SeedableRng is an extension trait for construction from fixed seeds and +other random number generators.

+

Error is provided for error-handling. It is safe to use in no_std +environments.

+

The impls and le sub-modules include a few small functions to assist +implementation of RngCore.

+

Modules

+
block

The BlockRngCore trait and implementation helpers

+
impls

Helper functions for implementing RngCore functions.

+
le

Little-Endian utilities

+

Structs

+
Error

Error type of random number generators

+
OsRng

A random number generator that retrieves randomness from from the +operating system.

+

Traits

+
CryptoRng

A marker trait used to indicate that an RngCore or BlockRngCore +implementation is supposed to be cryptographically secure.

+
RngCore

The core of a random number generator.

+
SeedableRng

A random number generator that can be explicitly seeded.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/le/fn.read_u32_into.html b/tests/html/1.49.0/rand_core/le/fn.read_u32_into.html new file mode 100644 index 0000000..9604b54 --- /dev/null +++ b/tests/html/1.49.0/rand_core/le/fn.read_u32_into.html @@ -0,0 +1,4 @@ +rand_core::le::read_u32_into - Rust

[][src]Function rand_core::le::read_u32_into

pub fn read_u32_into(src: &[u8], dst: &mut [u32])

Reads unsigned 32 bit integers from src into dst. +Borrowed from the byteorder crate.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/le/fn.read_u64_into.html b/tests/html/1.49.0/rand_core/le/fn.read_u64_into.html new file mode 100644 index 0000000..8f3c829 --- /dev/null +++ b/tests/html/1.49.0/rand_core/le/fn.read_u64_into.html @@ -0,0 +1,4 @@ +rand_core::le::read_u64_into - Rust

[][src]Function rand_core::le::read_u64_into

pub fn read_u64_into(src: &[u8], dst: &mut [u64])

Reads unsigned 64 bit integers from src into dst. +Borrowed from the byteorder crate.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/le/index.html b/tests/html/1.49.0/rand_core/le/index.html new file mode 100644 index 0000000..e80a104 --- /dev/null +++ b/tests/html/1.49.0/rand_core/le/index.html @@ -0,0 +1,10 @@ +rand_core::le - Rust

[][src]Module rand_core::le

Little-Endian utilities

+

Little-Endian order has been chosen for internal usage; this makes some +useful functions available.

+

Functions

+
read_u32_into

Reads unsigned 32 bit integers from src into dst. +Borrowed from the byteorder crate.

+
read_u64_into

Reads unsigned 64 bit integers from src into dst. +Borrowed from the byteorder crate.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/le/sidebar-items.js b/tests/html/1.49.0/rand_core/le/sidebar-items.js new file mode 100644 index 0000000..a18f3ad --- /dev/null +++ b/tests/html/1.49.0/rand_core/le/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["read_u32_into","Reads unsigned 32 bit integers from `src` into `dst`. Borrowed from the `byteorder` crate."],["read_u64_into","Reads unsigned 64 bit integers from `src` into `dst`. Borrowed from the `byteorder` crate."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/os/struct.OsRng.html b/tests/html/1.49.0/rand_core/os/struct.OsRng.html new file mode 100644 index 0000000..de458ba --- /dev/null +++ b/tests/html/1.49.0/rand_core/os/struct.OsRng.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../rand_core/struct.OsRng.html...

+ + + \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/sidebar-items.js b/tests/html/1.49.0/rand_core/sidebar-items.js new file mode 100644 index 0000000..36b365a --- /dev/null +++ b/tests/html/1.49.0/rand_core/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"mod":[["block","The `BlockRngCore` trait and implementation helpers"],["impls","Helper functions for implementing `RngCore` functions."],["le","Little-Endian utilities"]],"struct":[["Error","Error type of random number generators"],["OsRng","A random number generator that retrieves randomness from from the operating system."]],"trait":[["CryptoRng","A marker trait used to indicate that an [`RngCore`] or `BlockRngCore` implementation is supposed to be cryptographically secure."],["RngCore","The core of a random number generator."],["SeedableRng","A random number generator that can be explicitly seeded."]]}); \ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/struct.Error.html b/tests/html/1.49.0/rand_core/struct.Error.html new file mode 100644 index 0000000..dcf2a4f --- /dev/null +++ b/tests/html/1.49.0/rand_core/struct.Error.html @@ -0,0 +1,47 @@ +rand_core::Error - Rust

[][src]Struct rand_core::Error

pub struct Error { /* fields omitted */ }

Error type of random number generators

+

In order to be compatible with std and no_std, this type has two +possible implementations: with std a boxed Error trait object is stored, +while with no_std we merely store an error code.

+

Implementations

impl Error[src]

pub fn new<E>(err: E) -> Self where
    E: Into<Box<dyn Error + Send + Sync + 'static>>, 
[src]

Construct from any type supporting std::error::Error

+

Available only when configured with std.

+

See also From<NonZeroU32>, which is available with and without std.

+

pub fn inner(&self) -> &(dyn Error + Send + Sync + 'static)[src]

Reference the inner error (std only)

+

When configured with std, this is a trivial operation and never +panics. Without std, this method is simply unavailable.

+

pub fn take_inner(self) -> Box<dyn Error + Send + Sync + 'static>[src]

Unwrap the inner error (std only)

+

When configured with std, this is a trivial operation and never +panics. Without std, this method is simply unavailable.

+

pub const INTERNAL_START: u32[src]

Codes below this point represent OS Errors (i.e. positive i32 values). +Codes at or above this point, but below Error::CUSTOM_START are +reserved for use by the rand and getrandom crates.

+

pub const CUSTOM_START: u32[src]

Codes at or above this point can be used by users to define their own +custom errors.

+

pub fn raw_os_error(&self) -> Option<i32>[src]

Extract the raw OS error code (if this error came from the OS)

+

This method is identical to std::io::Error::raw_os_error(), except +that it works in no_std contexts. If this method returns None, the +error value can still be formatted via the Diplay implementation.

+

pub fn code(&self) -> Option<NonZeroU32>[src]

Retrieve the error code, if any.

+

If this Error was constructed via From<NonZeroU32>, then this method +will return this NonZeroU32 code (for no_std this is always the +case). Otherwise, this method will return None.

+

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<Error> for Error[src]

impl From<Error> for Error[src]

impl From<NonZeroU32> for Error[src]

Auto Trait Implementations

impl !RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/struct.OsRng.html b/tests/html/1.49.0/rand_core/struct.OsRng.html new file mode 100644 index 0000000..c615eea --- /dev/null +++ b/tests/html/1.49.0/rand_core/struct.OsRng.html @@ -0,0 +1,45 @@ +rand_core::OsRng - Rust

[][src]Struct rand_core::OsRng

pub struct OsRng;

A random number generator that retrieves randomness from from the +operating system.

+

This is a zero-sized struct. It can be freely constructed with OsRng.

+

The implementation is provided by the getrandom crate. Refer to +getrandom documentation for details.

+

This struct is only available when specifying the crate feature getrandom +or std. When using the rand lib, it is also available as rand::rngs::OsRng.

+

Blocking and error handling

+

It is possible that when used during early boot the first call to OsRng +will block until the system's RNG is initialised. It is also possible +(though highly unlikely) for OsRng to fail on some platforms, most +likely due to system mis-configuration.

+

After the first successful call, it is highly unlikely that failures or +significant delays will occur (although performance should be expected to +be much slower than a user-space PRNG).

+

Usage example

+
+use rand_core::{RngCore, OsRng};
+
+let mut key = [0u8; 16];
+OsRng.fill_bytes(&mut key);
+let random_u64 = OsRng.next_u64();
+

Trait Implementations

impl Clone for OsRng[src]

impl Copy for OsRng[src]

impl CryptoRng for OsRng[src]

impl Debug for OsRng[src]

impl Default for OsRng[src]

impl RngCore for OsRng[src]

Auto Trait Implementations

impl RefUnwindSafe for OsRng

impl Send for OsRng

impl Sync for OsRng

impl Unpin for OsRng

impl UnwindSafe for OsRng

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/trait.CryptoRng.html b/tests/html/1.49.0/rand_core/trait.CryptoRng.html new file mode 100644 index 0000000..bceca4e --- /dev/null +++ b/tests/html/1.49.0/rand_core/trait.CryptoRng.html @@ -0,0 +1,18 @@ +rand_core::CryptoRng - Rust

[][src]Trait rand_core::CryptoRng

pub trait CryptoRng { }

A marker trait used to indicate that an RngCore or BlockRngCore +implementation is supposed to be cryptographically secure.

+

Cryptographically secure generators, also known as CSPRNGs, should +satisfy an additional properties over other generators: given the first +k bits of an algorithm's output +sequence, it should not be possible using polynomial-time algorithms to +predict the next bit with probability significantly greater than 50%.

+

Some generators may satisfy an additional property, however this is not +required by this trait: if the CSPRNG's state is revealed, it should not be +computationally-feasible to reconstruct output prior to this. Some other +generators allow backwards-computation and are consided reversible.

+

Note that this trait is provided for guidance only and cannot guarantee +suitability for cryptographic applications. In general it should only be +implemented for well-reviewed code implementing well-regarded algorithms.

+

Note also that use of a CryptoRng does not protect against other +weaknesses such as seeding from a weak entropy source or leaking state.

+

Implementations on Foreign Types

impl<'a, R: CryptoRng + ?Sized> CryptoRng for &'a mut R[src]

impl<R: CryptoRng + ?Sized> CryptoRng for Box<R>[src]

Loading content...

Implementors

impl CryptoRng for OsRng[src]

impl<R: BlockRngCore + CryptoRng> CryptoRng for BlockRng<R>[src]

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/trait.RngCore.html b/tests/html/1.49.0/rand_core/trait.RngCore.html new file mode 100644 index 0000000..e7dff01 --- /dev/null +++ b/tests/html/1.49.0/rand_core/trait.RngCore.html @@ -0,0 +1,114 @@ +rand_core::RngCore - Rust

[][src]Trait rand_core::RngCore

pub trait RngCore {
+    fn next_u32(&mut self) -> u32;
+
fn next_u64(&mut self) -> u64; +
fn fill_bytes(&mut self, dest: &mut [u8]); +
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>; +}

The core of a random number generator.

+

This trait encapsulates the low-level functionality common to all +generators, and is the "back end", to be implemented by generators. +End users should normally use the Rng trait from the rand crate, +which is automatically implemented for every type implementing RngCore.

+

Three different methods for generating random data are provided since the +optimal implementation of each is dependent on the type of generator. There +is no required relationship between the output of each; e.g. many +implementations of fill_bytes consume a whole number of u32 or u64 +values and drop any remaining unused bytes.

+

The try_fill_bytes method is a variant of fill_bytes allowing error +handling; it is not deemed sufficiently useful to add equivalents for +next_u32 or next_u64 since the latter methods are almost always used +with algorithmic generators (PRNGs), which are normally infallible.

+

Algorithmic generators implementing SeedableRng should normally have +portable, reproducible output, i.e. fix Endianness when converting values +to avoid platform differences, and avoid making any changes which affect +output (except by communicating that the release has breaking changes).

+

Typically implementators will implement only one of the methods available +in this trait directly, then use the helper functions from the +impls module to implement the other methods.

+

It is recommended that implementations also implement:

+
    +
  • Debug with a custom implementation which does not print any internal +state (at least, CryptoRngs should not risk leaking state through +Debug).
  • +
  • Serialize and Deserialize (from Serde), preferably making Serde +support optional at the crate level in PRNG libs.
  • +
  • Clone, if possible.
  • +
  • never implement Copy (accidental copies may cause repeated values).
  • +
  • do not implement Default for pseudorandom generators, but instead +implement SeedableRng, to guide users towards proper seeding. +External / hardware RNGs can choose to implement Default.
  • +
  • Eq and PartialEq could be implemented, but are probably not useful.
  • +
+

Example

+

A simple example, obviously not generating very random output:

+ +
+#![allow(dead_code)]
+use rand_core::{RngCore, Error, impls};
+
+struct CountingRng(u64);
+
+impl RngCore for CountingRng {
+    fn next_u32(&mut self) -> u32 {
+        self.next_u64() as u32
+    }
+
+    fn next_u64(&mut self) -> u64 {
+        self.0 += 1;
+        self.0
+    }
+
+    fn fill_bytes(&mut self, dest: &mut [u8]) {
+        impls::fill_bytes_via_next(self, dest)
+    }
+
+    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+        Ok(self.fill_bytes(dest))
+    }
+}
+

Required methods

fn next_u32(&mut self) -> u32

Return the next random u32.

+

RNGs must implement at least one method from this trait directly. In +the case this method is not implemented directly, it can be implemented +using self.next_u64() as u32 or via +fill_bytes.

+

fn next_u64(&mut self) -> u64

Return the next random u64.

+

RNGs must implement at least one method from this trait directly. In +the case this method is not implemented directly, it can be implemented +via next_u32 or via +fill_bytes.

+

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data.

+

RNGs must implement at least one method from this trait directly. In +the case this method is not implemented directly, it can be implemented +via next_u* or +via try_fill_bytes; if this generator can +fail the implementation must choose how best to handle errors here +(e.g. panic with a descriptive message or log a warning and retry a few +times).

+

This method should guarantee that dest is entirely filled +with new data, and may panic if this is impossible +(e.g. reading past the end of a file that is being used as the +source of randomness).

+

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data.

+

This is the only method which allows an RNG to report errors while +generating random data thus making this the primary method implemented +by external (true) RNGs (e.g. OsRng) which can fail. It may be used +directly to generate keys and to seed (infallible) PRNGs.

+

Other than error handling, this method is identical to fill_bytes; +thus this may be implemented using Ok(self.fill_bytes(dest)) or +fill_bytes may be implemented with +self.try_fill_bytes(dest).unwrap() or more specific error handling.

+
Loading content...

Trait Implementations

impl Read for dyn RngCore[src]

Implementations on Foreign Types

impl<'a, R: RngCore + ?Sized> RngCore for &'a mut R[src]

impl<R: RngCore + ?Sized> RngCore for Box<R>[src]

Loading content...

Implementors

impl RngCore for OsRng[src]

impl<R: BlockRngCore<Item = u32>> RngCore for BlockRng<R> where
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

impl<R: BlockRngCore<Item = u64>> RngCore for BlockRng64<R> where
    <R as BlockRngCore>::Results: AsRef<[u64]> + AsMut<[u64]>, 
[src]

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/rand_core/trait.SeedableRng.html b/tests/html/1.49.0/rand_core/trait.SeedableRng.html new file mode 100644 index 0000000..2fa44f0 --- /dev/null +++ b/tests/html/1.49.0/rand_core/trait.SeedableRng.html @@ -0,0 +1,109 @@ +rand_core::SeedableRng - Rust

[][src]Trait rand_core::SeedableRng

pub trait SeedableRng: Sized {
+    type Seed: Sized + Default + AsMut<[u8]>;
+    fn from_seed(seed: Self::Seed) -> Self;
+
+    fn seed_from_u64(state: u64) -> Self { ... }
+
fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error> { ... } +
fn from_entropy() -> Self { ... } +}

A random number generator that can be explicitly seeded.

+

This trait encapsulates the low-level functionality common to all +pseudo-random number generators (PRNGs, or algorithmic generators).

+

Associated Types

type Seed: Sized + Default + AsMut<[u8]>

Seed type, which is restricted to types mutably-dereferencable as u8 +arrays (we recommend [u8; N] for some N).

+

It is recommended to seed PRNGs with a seed of at least circa 100 bits, +which means an array of [u8; 12] or greater to avoid picking RNGs with +partially overlapping periods.

+

For cryptographic RNG's a seed of 256 bits is recommended, [u8; 32].

+

Implementing SeedableRng for RNGs with large seeds

+

Note that the required traits core::default::Default and +core::convert::AsMut<u8> are not implemented for large arrays +[u8; N] with N > 32. To be able to implement the traits required by +SeedableRng for RNGs with such large seeds, the newtype pattern can be +used:

+ +
+use rand_core::SeedableRng;
+
+const N: usize = 64;
+pub struct MyRngSeed(pub [u8; N]);
+pub struct MyRng(MyRngSeed);
+
+impl Default for MyRngSeed {
+    fn default() -> MyRngSeed {
+        MyRngSeed([0; N])
+    }
+}
+
+impl AsMut<[u8]> for MyRngSeed {
+    fn as_mut(&mut self) -> &mut [u8] {
+        &mut self.0
+    }
+}
+
+impl SeedableRng for MyRng {
+    type Seed = MyRngSeed;
+
+    fn from_seed(seed: MyRngSeed) -> MyRng {
+        MyRng(seed)
+    }
+}
+
Loading content...

Required methods

fn from_seed(seed: Self::Seed) -> Self

Create a new PRNG using the given seed.

+

PRNG implementations are allowed to assume that bits in the seed are +well distributed. That means usually that the number of one and zero +bits are roughly equal, and values like 0, 1 and (size - 1) are unlikely. +Note that many non-cryptographic PRNGs will show poor quality output +if this is not adhered to. If you wish to seed from simple numbers, use +seed_from_u64 instead.

+

All PRNG implementations should be reproducible unless otherwise noted: +given a fixed seed, the same sequence of output should be produced +on all runs, library versions and architectures (e.g. check endianness). +Any "value-breaking" changes to the generator should require bumping at +least the minor version and documentation of the change.

+

It is not required that this function yield the same state as a +reference implementation of the PRNG given equivalent seed; if necessary +another constructor replicating behaviour from a reference +implementation can be added.

+

PRNG implementations should make sure from_seed never panics. In the +case that some special values (like an all zero seed) are not viable +seeds it is preferable to map these to alternative constant value(s), +for example 0xBAD5EEDu32 or 0x0DDB1A5E5BAD5EEDu64 ("odd biases? bad +seed"). This is assuming only a small number of values must be rejected.

+
Loading content...

Provided methods

fn seed_from_u64(state: u64) -> Self

Create a new PRNG using a u64 seed.

+

This is a convenience-wrapper around from_seed to allow construction +of any SeedableRng from a simple u64 value. It is designed such that +low Hamming Weight numbers like 0 and 1 can be used and should still +result in good, independent seeds to the PRNG which is returned.

+

This is not suitable for cryptography, as should be clear given that +the input size is only 64 bits.

+

Implementations for PRNGs may provide their own implementations of +this function, but the default implementation should be good enough for +all purposes. Changing the implementation of this function should be +considered a value-breaking change.

+

fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error>

Create a new PRNG seeded from another Rng.

+

This may be useful when needing to rapidly seed many PRNGs from a master +PRNG, and to allow forking of PRNGs. It may be considered deterministic.

+

The master PRNG should be at least as high quality as the child PRNGs. +When seeding non-cryptographic child PRNGs, we recommend using a +different algorithm for the master PRNG (ideally a CSPRNG) to avoid +correlations between the child PRNGs. If this is not possible (e.g. +forking using small non-crypto PRNGs) ensure that your PRNG has a good +mixing function on the output or consider use of a hash function with +from_seed.

+

Note that seeding XorShiftRng from another XorShiftRng provides an +extreme example of what can go wrong: the new PRNG will be a clone +of the parent.

+

PRNG implementations are allowed to assume that a good RNG is provided +for seeding, and that it is cryptographically secure when appropriate. +As of rand 0.7 / rand_core 0.5, implementations overriding this +method should ensure the implementation satisfies reproducibility +(in prior versions this was not required).

+

fn from_entropy() -> Self

Creates a new instance of the RNG seeded via getrandom.

+

This method is the recommended way to construct non-deterministic PRNGs +since it is convenient and secure.

+

In case the overhead of using getrandom to seed many PRNGs is an +issue, one may prefer to seed from a local PRNG, e.g. +from_rng(thread_rng()).unwrap().

+

Panics

+

If getrandom is unable to provide secure entropy this method will panic.

+
Loading content...

Implementors

impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng64<R>[src]

type Seed = R::Seed

impl<R: BlockRngCore + SeedableRng> SeedableRng for BlockRng<R>[src]

type Seed = R::Seed

Loading content...
\ No newline at end of file diff --git a/tests/html/1.49.0/search-index.js b/tests/html/1.49.0/search-index.js new file mode 100644 index 0000000..d33c8bf --- /dev/null +++ b/tests/html/1.49.0/search-index.js @@ -0,0 +1,7 @@ +var searchIndex = JSON.parse('{\ +"anyhow":{"doc":"github crates-io docs-rs","i":[[3,"Error","anyhow","The `Error` type, a wrapper around a dynamic error type.",null,null],[3,"Chain","","Iterator of a chain of source errors.",null,null],[11,"new","","",0,[[["stderror",8]]]],[11,"new","","Create a new error object from any error type.",1,[[]]],[11,"msg","","Create a new error object from a printable error message.",1,[[]]],[11,"context","","Wrap the error value with additional context.",1,[[]]],[11,"chain","","An iterator of the chain of source errors contained by…",1,[[],["chain",3]]],[11,"root_cause","","The lowest level cause of this error — this error\'s…",1,[[],["stderror",8]]],[11,"is","","Returns true if `E` is the type held by this error object.",1,[[]]],[11,"downcast","","Attempt to downcast the error object to a concrete type.",1,[[],["result",4]]],[11,"downcast_ref","","Downcast this error object by reference.",1,[[],["option",4]]],[11,"downcast_mut","","Downcast this error object by mutable reference.",1,[[],["option",4]]],[6,"Result","","`Result`",null,null],[8,"Context","","Provides the `context` method for `Result`.",null,null],[10,"context","","Wrap the error value with additional context.",2,[[],[["result",6],["error",3]]]],[10,"with_context","","Wrap the error value with additional context that is…",2,[[],[["result",6],["error",3]]]],[14,"bail","","Return early with an error.",null,null],[14,"ensure","","Return early with an error if a condition is not satisfied.",null,null],[14,"anyhow","","Construct an ad-hoc error from a string.",null,null],[11,"from","","",1,[[]]],[11,"from","","",1,[[]]],[11,"into","","",1,[[]]],[11,"to_string","","",1,[[],["string",3]]],[11,"borrow","","",1,[[]]],[11,"borrow_mut","","",1,[[]]],[11,"try_from","","",1,[[],["result",4]]],[11,"try_into","","",1,[[],["result",4]]],[11,"type_id","","",1,[[],["typeid",3]]],[11,"from","","",0,[[]]],[11,"into","","",0,[[]]],[11,"into_iter","","",0,[[]]],[11,"to_owned","","",0,[[]]],[11,"clone_into","","",0,[[]]],[11,"borrow","","",0,[[]]],[11,"borrow_mut","","",0,[[]]],[11,"try_from","","",0,[[],["result",4]]],[11,"try_into","","",0,[[],["result",4]]],[11,"type_id","","",0,[[],["typeid",3]]],[11,"drop","","",1,[[]]],[11,"as_ref","","",1,[[],["stderror",8]]],[11,"as_ref","","",1,[[],["stderror",8]]],[11,"from","","",1,[[]]],[11,"next_back","","",0,[[],["option",4]]],[11,"len","","",0,[[]]],[11,"next","","",0,[[],["option",4]]],[11,"size_hint","","",0,[[]]],[11,"clone","","",0,[[],["chain",3]]],[11,"default","","",0,[[]]],[11,"deref","","",1,[[]]],[11,"deref_mut","","",1,[[]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]]],"p":[[3,"Chain"],[3,"Error"],[8,"Context"]]},\ +"kuchiki":{"doc":"Kuchiki (朽木), a HTML/XML tree manipulation library for Rust.","i":[[3,"Attribute","kuchiki","The non-identifying parts of an attribute",null,null],[12,"prefix","","The namespace prefix, if any",0,null],[12,"value","","The attribute value",0,null],[3,"Attributes","","Convenience wrapper around a btreemap that adds method for…",null,null],[12,"map","","A map of attributes whose name can have namespaces.",1,null],[3,"ExpandedName","","https://www.w3.org/TR/REC-xml-names/#dt-expname",null,null],[12,"ns","","Namespace URL",2,null],[12,"local","","\\\"Local\\\" part of the name",2,null],[3,"NodeDataRef","","Holds a strong reference to a node, but dereferences to…",null,null],[3,"ParseOpts","","Options for the HTML parser.",null,null],[12,"tokenizer","","Options for the HTML tokenizer.",3,null],[12,"tree_builder","","Options for the HTML tree builder.",3,null],[12,"on_parse_error","","A callback for HTML parse errors (which are never fatal).",3,null],[3,"Selector","","A pre-compiled CSS Selector.",null,null],[3,"Selectors","","A pre-compiled list of CSS Selectors.",null,null],[12,"0","","",4,null],[3,"Specificity","","The specificity of a selector.",null,null],[3,"Doctype","","Data specific to doctype nodes.",null,null],[12,"name","","The name of the doctype",5,null],[12,"public_id","","The public ID of the doctype",5,null],[12,"system_id","","The system ID of the doctype",5,null],[3,"DocumentData","","Data specific to document nodes.",null,null],[3,"ElementData","","Data specific to element nodes.",null,null],[12,"name","","The namespace and local name of the element, such as…",6,null],[12,"attributes","","The attributes of the elements.",6,null],[12,"template_contents","","If the element is an HTML `