Skip to main content

Marshallable

Trait Marshallable 

Source
pub trait Marshallable {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>
       where Self: Sized;
    fn empty() -> Self;
    fn to_bytes(&self) -> Option<Vec<u8>>;
    fn snapshot(&self) -> Self;
    fn has_changed(&self, other: &Self) -> bool;
}
Expand description

A trait for types that can be edited

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned when parsing fails

Required Methods§

Source

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>
where Self: Sized,

Parse the contents of a file

Source

fn empty() -> Self

Create an empty instance

Source

fn to_bytes(&self) -> Option<Vec<u8>>

Serialize the contents of a file

Source

fn snapshot(&self) -> Self

Create a snapshot of the current state

Source

fn has_changed(&self, other: &Self) -> bool

Check if the current state has changed compared to another state

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Marshallable for Deb822

Source§

type Error = Error

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Source§

impl Marshallable for ChangeLog

Source§

type Error = Error

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Source§

impl Marshallable for Control

Source§

type Error = Error

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Source§

type Error = Error

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Source§

impl Marshallable for WatchFile

Source§

type Error = Infallible

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Source§

impl Marshallable for Makefile

Source§

type Error = Error

Source§

fn from_bytes(content: &[u8]) -> Result<Self, Self::Error>

Source§

fn empty() -> Self

Source§

fn to_bytes(&self) -> Option<Vec<u8>>

Source§

fn snapshot(&self) -> Self

Source§

fn has_changed(&self, other: &Self) -> bool

Implementors§