Skip to content

Commit c797f07

Browse files
committed
rand_core: Rename CryptoRngCore::upcast to as_rngcore
1 parent fe236c5 commit c797f07

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

rand_chacha/src/chacha.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ mod test {
630630

631631
let rng = &mut ChaChaRng::from_seed(Default::default()) as &mut dyn CryptoRngCore;
632632
let r1 = rng.next_u64();
633-
let rng: &mut dyn RngCore = rng.upcast();
633+
let rng: &mut dyn RngCore = rng.as_rngcore();
634634
let r2 = rng.next_u64();
635635
assert_ne!(r1, r2);
636636
}

rand_core/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ pub trait CryptoRng {}
210210

211211
/// An extension trait to support trait objects that implement [`RngCore`] and
212212
/// [`CryptoRng`]. Upcasting to [`RngCore`] is supported via the
213-
/// [`CryptoRngCore::upcast`] method.
213+
/// [`CryptoRngCore::as_rngcore`] method.
214214
pub trait CryptoRngCore: RngCore {
215215
/// Upcast to an [`RngCore`] trait object.
216-
fn upcast(&mut self) -> &mut dyn RngCore;
216+
fn as_rngcore(&mut self) -> &mut dyn RngCore;
217217
}
218218

219219
impl<T: CryptoRng + RngCore> CryptoRngCore for T {
220-
fn upcast(&mut self) -> &mut dyn RngCore {
220+
fn as_rngcore(&mut self) -> &mut dyn RngCore {
221221
self
222222
}
223223
}

0 commit comments

Comments
 (0)