[−][src]Struct odds::Fix
Fixpoint combinator for rust closures, generalized over the return type.
Note: Use this best through the fix
function.
In Fix<T, R>, T is the argument type, and R is the return type, R defaults to T.
Calling the Fix
value only supports function call notation with the nightly
channel and the crate feature ‘unstable’ enabled; use the .call() method otherwise.
use odds::Fix; use odds::fix; let c = |f: Fix<i32>, x| if x == 0 { 1 } else { x * f.call(x - 1) }; let fact = Fix(&c); assert_eq!(fact.call(5), 120); let data = [true, false]; assert!(!fix(&data[..], |f, x| { x.len() == 0 || x[0] && f.call(&x[1..]) }));
Methods
impl<'a, T, R> Fix<'a, T, R>
[src]
Trait Implementations
impl<'a, T, R> Clone for Fix<'a, T, R>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T, R> Copy for Fix<'a, T, R>
[src]
Auto Trait Implementations
impl<'a, T, R = T> !RefUnwindSafe for Fix<'a, T, R>
impl<'a, T, R = T> !Send for Fix<'a, T, R>
impl<'a, T, R = T> !Sync for Fix<'a, T, R>
impl<'a, T, R> Unpin for Fix<'a, T, R>
impl<'a, T, R = T> !UnwindSafe for Fix<'a, T, R>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,