pub struct Loop<T, V, F, G>where
    F: Fn(T) -> T,
    G: Fn(T) -> V,{
    pub next: F,
    pub get_val: G,
    pub begin: T,
    pub loop_len: usize,
    pub loop_begin: T,
    pub loop_begin_idx: usize,
    pub before_loop_sum: V,
    pub loop_sum: V,
    /* private fields */
}

Fields§

§next: F

ノードの移動を行う関数

§get_val: G

ノードから値を取り出す関数

§begin: T

始点となるノード

§loop_len: usize

ループの長さ

§loop_begin: T

ループ開始時の値

§loop_begin_idx: usize

ループに到達するまでの移動回数

§before_loop_sum: V

ループ開始時までの累積

§loop_sum: V

ループ内での累積

Implementations§

source§

impl<T, V, F, G> Loop<T, V, F, G>where T: Copy + Hash + Eq, V: Copy + Zero + Add<Output = V> + Sub<Output = V> + Mul<usize, Output = V>, F: Fn(T) -> T, G: Fn(T) -> V,

source

pub fn build(begin: T, next: F, get_val: G) -> Self

ループを検出する

source

pub fn get_nth_node_usize(&self, n: usize) -> T

self.beginからn個後の頂点を取り出す

source

pub fn get_nth_val_usize(&self, n: usize) -> V

self.beginからn個後の値を取り出す

source

pub fn get_nth_node_biguint(&self, n: BigUint) -> T

self.beginからn個後の値を取り出す

Auto Trait Implementations§

§

impl<T, V, F, G> RefUnwindSafe for Loop<T, V, F, G>where F: RefUnwindSafe, G: RefUnwindSafe, T: RefUnwindSafe, V: RefUnwindSafe,

§

impl<T, V, F, G> Send for Loop<T, V, F, G>where F: Send, G: Send, T: Send, V: Send,

§

impl<T, V, F, G> Sync for Loop<T, V, F, G>where F: Sync, G: Sync, T: Sync, V: Sync,

§

impl<T, V, F, G> Unpin for Loop<T, V, F, G>where F: Unpin, G: Unpin, T: Unpin, V: Unpin,

§

impl<T, V, F, G> UnwindSafe for Loop<T, V, F, G>where F: UnwindSafe, G: UnwindSafe, T: UnwindSafe, V: UnwindSafe,

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · 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