Enum nekolib::utils::op_roll_hash::OpRollHash
source · pub enum OpRollHash<const B: u64> {
OpRollHashV,
}
Expand description
文字列連結をローリングハッシュで行う演算を持つ。
Examples
use nekolib::traits::Magma;
use nekolib::utils::OpRollHash;
let op_rh = OpRollHash::<998244353>::default();
let value_of = |s| op_rh.value_of(s);
let op = |x, y| op_rh.op(x, y);
let abr = value_of("abr");
let a = value_of("a");
let abra = value_of("abra");
assert_eq!(op(abr, a), abra);
let s = "abracadabra";
assert_eq!(value_of(&s[0..4]), abra);
assert_eq!(value_of(&s[7..11]), abra);
assert_ne!(value_of(&s[1..5]), abra);
assert_eq!(value_of(s), op(op(abra, value_of("cad")), abra));
Variants§
OpRollHashV
Implementations§
Trait Implementations§
source§impl<const B: u64> Clone for OpRollHash<B>
impl<const B: u64> Clone for OpRollHash<B>
source§fn clone(&self) -> OpRollHash<B>
fn clone(&self) -> OpRollHash<B>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<const B: u64> Debug for OpRollHash<B>
impl<const B: u64> Debug for OpRollHash<B>
source§impl<const B: u64> Default for OpRollHash<B>
impl<const B: u64> Default for OpRollHash<B>
source§impl<const B: u64> Magma for OpRollHash<B>
impl<const B: u64> Magma for OpRollHash<B>
source§impl<const B: u64> PartialEq<OpRollHash<B>> for OpRollHash<B>
impl<const B: u64> PartialEq<OpRollHash<B>> for OpRollHash<B>
source§fn eq(&self, other: &OpRollHash<B>) -> bool
fn eq(&self, other: &OpRollHash<B>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<const B: u64> Associative for OpRollHash<B>
impl<const B: u64> Copy for OpRollHash<B>
impl<const B: u64> Eq for OpRollHash<B>
impl<const B: u64> StructuralEq for OpRollHash<B>
impl<const B: u64> StructuralPartialEq for OpRollHash<B>
Auto Trait Implementations§
impl<const B: u64> RefUnwindSafe for OpRollHash<B>
impl<const B: u64> Send for OpRollHash<B>
impl<const B: u64> Sync for OpRollHash<B>
impl<const B: u64> Unpin for OpRollHash<B>
impl<const B: u64> UnwindSafe for OpRollHash<B>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more