mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-16 16:03:48 +00:00
18 lines
No EOL
7.1 KiB
HTML
18 lines
No EOL
7.1 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An extension trait that is automatically implemented for any type implementing `RngCore` and `CryptoRng`."><title>CryptoRngCore in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.6.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Crypto<wbr>RngCore</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_rngcore" title="as_rngcore">as_rngcore</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></span><h1>Trait <span class="trait">CryptoRngCore</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#229-232">Source</a> </span></div><pre class="rust item-decl"><code>pub trait CryptoRngCore: <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> + <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> {
|
|
// Required method
|
|
fn <a href="#tymethod.as_rngcore" class="fn">as_rngcore</a>(&mut self) -> &mut dyn <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> <a href="#" class="tooltip" data-notable-ty="&mut dyn RngCore">ⓘ</a>;
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An extension trait that is automatically implemented for any type
|
|
implementing <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> and <a href="trait.CryptoRng.html" title="trait rand_core::CryptoRng"><code>CryptoRng</code></a>.</p>
|
|
<p>It may be used as a trait object, and supports upcasting to <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> via
|
|
the <a href="trait.CryptoRngCore.html#tymethod.as_rngcore" title="method rand_core::CryptoRngCore::as_rngcore"><code>CryptoRngCore::as_rngcore</code></a> method.</p>
|
|
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rand_core::CryptoRngCore;
|
|
|
|
<span class="attr">#[allow(unused)]
|
|
</span><span class="kw">fn </span>make_token(rng: <span class="kw-2">&mut </span><span class="kw">dyn </span>CryptoRngCore) -> [u8; <span class="number">32</span>] {
|
|
<span class="kw">let </span><span class="kw-2">mut </span>buf = [<span class="number">0u8</span>; <span class="number">32</span>];
|
|
rng.fill_bytes(<span class="kw-2">&mut </span>buf);
|
|
buf
|
|
}</code></pre></div>
|
|
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.as_rngcore" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#231">Source</a><h4 class="code-header">fn <a href="#tymethod.as_rngcore" class="fn">as_rngcore</a>(&mut self) -> &mut dyn <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> <a href="#" class="tooltip" data-notable-ty="&mut dyn RngCore">ⓘ</a></h4></section></summary><div class="docblock"><p>Upcast to an <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> trait object.</p>
|
|
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-CryptoRngCore-for-T" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#234-238">Source</a><a href="#impl-CryptoRngCore-for-T" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> + <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a>> <a class="trait" href="trait.CryptoRngCore.html" title="trait rand_core::CryptoRngCore">CryptoRngCore</a> for T</h3></section></div><script src="../trait.impl/rand_core/trait.CryptoRngCore.js" async></script><script type="text/json" id="notable-traits-data">{"&mut dyn RngCore":"<h3>Notable traits for <code>dyn <a class=\"trait\" href=\"trait.RngCore.html\" title=\"trait rand_core::RngCore\">RngCore</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for dyn <a class=\"trait\" href=\"trait.RngCore.html\" title=\"trait rand_core::RngCore\">RngCore</a></div>"}</script></section></div></main></body></html> |