[][src]Trait sunrise_kernel::utils::Splittable

pub trait Splittable where
    Self: Sized
{ fn split_at(&mut self, offset: usize) -> Result<Option<Self>, KernelError>; fn right_split(
        &mut self,
        offset: usize
    ) -> Result<Option<Self>, KernelError> { ... } }

A trait for things that can be splitted in two parts

Required methods

fn split_at(&mut self, offset: usize) -> Result<Option<Self>, KernelError>

Split the given object in two at a given offset.

The left side is modified in place, and the new right side is returned.

If offset >= self.length, the object is untouched, and the right-hand side is None. If offset == 0, the object is untouched, and the right-hand side is None.

Loading content...

Provided methods

fn right_split(&mut self, offset: usize) -> Result<Option<Self>, KernelError>

Splits the given object in two at the given offset.

The right side is modified in place, and the new left side is returned.

Note that offset is still the distance from the start.

If offset >= self.length, the object is untouched, and the right-hand side is None. If offset == 0, the object is untouched, and the right-hand side is None.

Loading content...

Implementations on Foreign Types

impl Splittable for Vec<PhysicalMemRegion>[src]

fn split_at(&mut self, offset: usize) -> Result<Option<Self>, KernelError>[src]

Splits a Vec of Physical regions in two Vec at the given offset.

If the offset falls in the middle of a PhysicalMemRegion, it is splitted, and the right part is moved to the second Vec.

Errors

  • InvalidSize: offset is not PAGE_SIZE aligned.
Loading content...

Implementors

impl Splittable for PhysicalMemRegion[src]

fn split_at(&mut self, offset: usize) -> Result<Option<Self>, KernelError>[src]

Splits the given PhysicalMemRegion in two parts, at the given offset.

Errors

  • InvalidSize: offset is not PAGE_SIZE aligned.
Loading content...