pub struct Operations { /* private fields */ }
Implementations§
Source§impl Operations
impl Operations
pub fn new(operations: Vec<Operation>) -> Operations
Sourcepub fn new_orientation(orientation: Orientation) -> Operations
pub fn new_orientation(orientation: Orientation) -> Operations
Creates new operations that apply the specified orientation
Sourcepub fn prepend(&mut self, operations: Operations)
pub fn prepend(&mut self, operations: Operations)
Prepend operations
let mut ops = Operations::new(vec![Operation::MirrorVertically]);
ops.prepend(Operations::new_orientation(Orientation::Rotation90));
assert_eq!(
ops.operations(),
&[
Operation::Rotate(Rotation::_90),
Operation::MirrorVertically
]
);
pub fn from_read(reader: impl Read) -> Result<Operations, Error>
pub fn from_slice(slice: impl AsRef<[u8]>) -> Result<Operations, Error>
pub fn to_message_pack(&self) -> Result<Vec<u8>, Error>
pub fn operations(&self) -> &[Operation]
pub fn operation_ids(&self) -> Vec<OperationId>
Sourcepub fn unknown_operations(&self) -> &[String]
pub fn unknown_operations(&self) -> &[String]
Returns information about all operations that were unknown when deserializing
Sourcepub fn orientation(&self) -> Option<Orientation>
pub fn orientation(&self) -> Option<Orientation>
Returns an Orientation
if all operations can be reduced to that
assert_eq!(
Operations::new(vec![
Operation::Rotate(Rotation::_180),
Operation::Rotate(Rotation::_270)
])
.orientation(),
Some(Orientation::Rotation90)
);
assert_eq!(
Operations::new(vec![
Operation::Rotate(Rotation::_90),
Operation::MirrorHorizontally
])
.orientation(),
Some(Orientation::MirroredRotation270)
);
assert_eq!(
Operations::new(vec![
Operation::MirrorHorizontally,
Operation::MirrorVertically,
Operation::Rotate(Rotation::_270),
Operation::MirrorHorizontally,
])
.orientation(),
Some(Orientation::MirroredRotation270)
);
Trait Implementations§
Source§impl Debug for Operations
impl Debug for Operations
Source§impl<'de> Deserialize<'de> for Operations
impl<'de> Deserialize<'de> for Operations
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Operations, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Operations, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<OperationsIntermediate> for Operations
impl From<OperationsIntermediate> for Operations
Source§fn from(operations: OperationsIntermediate) -> Operations
fn from(operations: OperationsIntermediate) -> Operations
Converts to this type from the input type.
Source§impl PartialEq for Operations
impl PartialEq for Operations
Source§impl Serialize for Operations
impl Serialize for Operations
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Operations
Auto Trait Implementations§
impl Freeze for Operations
impl RefUnwindSafe for Operations
impl Send for Operations
impl Sync for Operations
impl Unpin for Operations
impl UnwindSafe for Operations
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more