[][src]Trait series::AsSlice

pub trait AsSlice<'a, T> {
    type Output;
    fn as_slice(&'a self, t: T) -> Self::Output;
}

View a slice of the original object

Associated Types

type Output

Loading content...

Required methods

fn as_slice(&'a self, t: T) -> Self::Output

Loading content...

Implementors

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, Range<isize>> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, Range<isize>> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: Range<isize>) -> Self::Output[src]

A slice of the series truncated to the given range of powers.

Panics

Panics if the lower bound is smaller than the leading power or the upper bound is at least as big as the cut-off power.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(0..2);
assert_eq!(t.min_pow(), 0);
assert_eq!(t.cutoff_pow(), 2);
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert!(std::panic::catch_unwind(|| t[2]).is_err());

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeFrom<isize>> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeFrom<isize>> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: RangeFrom<isize>) -> Self::Output[src]

A slice of the series truncated to the given range of powers.

Panics

Panics if the lower bound is smaller than the leading power.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(0..);
assert_eq!(t.min_pow(), 0);
assert_eq!(t.cutoff_pow(), s.cutoff_pow());
assert!(std::panic::catch_unwind(|| t[-1]).is_err());
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert_eq!(t[2], s[2]);

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeFull> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeFull> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: RangeFull) -> Self::Output[src]

A slice containing the complete series.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(..);
assert_eq!(t.min_pow(), s.min_pow());
assert_eq!(t.cutoff_pow(), s.cutoff_pow());
assert_eq!(t[-1], s[-1]);
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert_eq!(t[2], s[2]);

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeInclusive<isize>> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeInclusive<isize>> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: RangeInclusive<isize>) -> Self::Output[src]

A slice of the series truncated to the given range of powers.

Panics

Panics if the lower bound is smaller than the leading power or the upper bound is at least as big as the cut-off power.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(0..=1);
assert_eq!(t.min_pow(), 0);
assert_eq!(t.cutoff_pow(), 2);
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert!(std::panic::catch_unwind(|| t[2]).is_err());

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeTo<isize>> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeTo<isize>> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: RangeTo<isize>) -> Self::Output[src]

A slice of the series truncated to the given range of powers.

Panics

Panics if the upper bound is at least as big as the cut-off power.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(..2);
assert_eq!(t.min_pow(), s.min_pow());
assert_eq!(t.cutoff_pow(), 2);
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert!(std::panic::catch_unwind(|| t[2]).is_err());

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeToInclusive<isize>> for Polynomial<Var, C>[src]

type Output = PolynomialSlice<'a, Var, C>

impl<'a, Var: 'a, C: 'a + Coeff> AsSlice<'a, RangeToInclusive<isize>> for Series<Var, C>[src]

type Output = SeriesSlice<'a, Var, C>

fn as_slice(&'a self, r: RangeToInclusive<isize>) -> Self::Output[src]

A slice of the series truncated to the given range of powers.

Panics

Panics if the upper bound is at least as big as the cut-off power.

Example

use series::AsSlice;
let s = series::Series::new("x", -1, vec!(1,2,3,4));
let t = s.as_slice(..=1);
assert_eq!(t.min_pow(), s.min_pow());
assert_eq!(t.cutoff_pow(), 2);
assert_eq!(t[0], s[0]);
assert_eq!(t[1], s[1]);
assert!(std::panic::catch_unwind(|| t[2]).is_err());
Loading content...