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§

source§

impl<const B: u64> OpRollHash<B>

source

pub fn value_of(&self, s: &str) -> <Self as Magma>::Set

Trait Implementations§

source§

impl<const B: u64> Clone for OpRollHash<B>

source§

fn clone(&self) -> OpRollHash<B>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<const B: u64> Debug for OpRollHash<B>

source§

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

Formats the value using the given formatter. Read more
source§

impl<const B: u64> Default for OpRollHash<B>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const B: u64> Identity for OpRollHash<B>

source§

fn id(&self) -> Self::Set

単位元を返す。
source§

impl<const B: u64> Magma for OpRollHash<B>

§

type Set = (u64, u64)

集合 $M$ に対応する型。
source§

fn op(&self, (hx, lx): Self::Set, (hy, ly): Self::Set) -> Self::Set

$x \circ y$ を返す。
source§

impl<const B: u64> PartialEq<OpRollHash<B>> for OpRollHash<B>

source§

fn eq(&self, other: &OpRollHash<B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const B: u64> Associative for OpRollHash<B>

source§

impl<const B: u64> Copy for OpRollHash<B>

source§

impl<const B: u64> Eq for OpRollHash<B>

source§

impl<const B: u64> StructuralEq for OpRollHash<B>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<G> Monoid for Gwhere G: Identity + Semigroup,

source§

impl<G> Semigroup for Gwhere G: Associative + Magma,