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<Self, Error>
pub fn from_slice(slice: impl AsRef<[u8]>) -> Result<Self, 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Operations
impl PartialEq for Operations
Source§impl Serialize for Operations
impl Serialize for Operations
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