[][src]Struct flips::BpsLinearBuilder

pub struct BpsLinearBuilder<S: AsRef<[u8]>, T: AsRef<[u8]>, M: AsRef<[u8]> = &'static [u8]> { /* fields omitted */ }

A builder to create a BPS patch.

This type is as generic as possible, making it easy to use any type that can be viewed as a slice of bytes.

Example

let patch = flips::BpsLinearBuilder::new()
    .source(&b"some source bytes"[..])
    .target(&b"some target bytes"[..])
    .build()
    .expect("could not create patch");

Methods

impl<S: AsRef<[u8]>, T: AsRef<[u8]>> BpsLinearBuilder<S, T, &'static [u8]>[src]

pub fn new() -> Self[src]

Create a new builder for an BPS patch.

pub fn metadata<M: AsRef<[u8]>, B: Into<Option<M>>>(
    &mut self,
    buffer: B
) -> BpsLinearBuilder<S, T, M>
[src]

Set the metadata buffer for the patch, if any.

impl<S: AsRef<[u8]>, T: AsRef<[u8]>, M: AsRef<[u8]>> BpsLinearBuilder<S, T, M>[src]

pub fn source(&mut self, source: S) -> &mut Self[src]

Set the source buffer for the patch.

pub fn target(&mut self, target: T) -> &mut Self[src]

Set the target buffer for the patch.

#[must_use]pub fn build(&mut self) -> Result<BpsPatch<FlipsMemory>>[src]

Build an BPS patch from source to target with metadata if any.

Error

If either source or target was not given, this method will return Error::Canceled.

Trait Implementations

impl<S: Clone + AsRef<[u8]>, T: Clone + AsRef<[u8]>, M: Clone + AsRef<[u8]>> Clone for BpsLinearBuilder<S, T, M>[src]

impl<S: Debug + AsRef<[u8]>, T: Debug + AsRef<[u8]>, M: Debug + AsRef<[u8]>> Debug for BpsLinearBuilder<S, T, M>[src]

impl<S: Default + AsRef<[u8]>, T: Default + AsRef<[u8]>, M: Default + AsRef<[u8]>> Default for BpsLinearBuilder<S, T, M>[src]

Auto Trait Implementations

impl<S, T, M> RefUnwindSafe for BpsLinearBuilder<S, T, M> where
    M: RefUnwindSafe,
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<S, T, M> Send for BpsLinearBuilder<S, T, M> where
    M: Send,
    S: Send,
    T: Send

impl<S, T, M> Sync for BpsLinearBuilder<S, T, M> where
    M: Sync,
    S: Sync,
    T: Sync

impl<S, T, M> Unpin for BpsLinearBuilder<S, T, M> where
    M: Unpin,
    S: Unpin,
    T: Unpin

impl<S, T, M> UnwindSafe for BpsLinearBuilder<S, T, M> where
    M: UnwindSafe,
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.