| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 3 | |
| 4 | use gufo_commonrust-analyzer cargo gufo-common 1.1.0 crate/::orientationrust-analyzer cargo gufo-common 1.1.0 orientation/::{Orientationrust-analyzer cargo gufo-common 1.1.0 orientation/Orientation#, Rotationrust-analyzer cargo gufo-common 1.1.0 orientation/Rotation#}; |
| 5 | use serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/::{IntoDeserializerrust-analyzer cargo serde_core 1.0.228 de/IntoDeserializer#, valuerust-analyzer cargo serde_core 1.0.228 de/value/}; |
| 6 | use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#}; |
| 7 | |
| 8 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 9 | #[non_exhaustive] |
| 10 | pub enum Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation# { |
| 11 | Cliprust-analyzer cargo glycin-common 1.0.4 operations/Operation#Clip#((u32, u32, u32, u32)), |
| 12 | MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorHorizontally#, |
| 13 | MirrorVerticallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorVertically#, |
| 14 | /// Counter-clockwise rotation |
| 15 | Rotaterust-analyzer cargo glycin-common 1.0.4 operations/Operation#Rotate#(gufo_commonrust-analyzer cargo gufo-common 1.1.0 crate/::orientationrust-analyzer cargo gufo-common 1.1.0 orientation/::Rotationrust-analyzer cargo gufo-common 1.1.0 orientation/Rotation#), |
| 16 | } |
| 17 | |
| 18 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 19 | #[non_exhaustive] |
| 20 | pub enum OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId# { |
| 21 | Cliprust-analyzer cargo glycin-common 1.0.4 operations/OperationId#Clip#, |
| 22 | MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#MirrorHorizontally#, |
| 23 | MirrorVerticallyrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#MirrorVertically#, |
| 24 | Rotaterust-analyzer cargo glycin-common 1.0.4 operations/OperationId#Rotate#, |
| 25 | } |
| 26 | |
| 27 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 28 | #[serde(from = "OperationsIntermediate")] |
| 29 | pub struct Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 30 | operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#>, |
| 31 | #[serderust-analyzer cargo serde_derive 1.0.228 serde:(skip)] |
| 32 | unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#unknown_operations.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 33 | } |
| 34 | |
| 35 | impl Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 36 | pub fn newrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]new().(operations: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#>) -> Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 37 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations] { |
| 38 | operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations., |
| 39 | unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#unknown_operations.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /// Creates new operations that apply the specified orientation |
| 44 | pub fn new_orientationrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]new_orientation().(orientation: Orientationrust-analyzer cargo gufo-common 1.1.0 orientation/Orientation#) -> Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 45 | let mut operations = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 46 | |
| 47 | if orientation.mirrorrust-analyzer cargo gufo-common 1.1.0 orientation/impl#[Orientation]mirror().() { |
| 48 | operations.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#::MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorHorizontally#); |
| 49 | } |
| 50 | |
| 51 | let rotate = orientation.rotaterust-analyzer cargo gufo-common 1.1.0 orientation/impl#[Orientation]rotate().(); |
| 52 | if rotate rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Rotationrust-analyzer cargo gufo-common 1.1.0 orientation/Rotation#::_0rust-analyzer cargo gufo-common 1.1.0 orientation/Rotation#_0# { |
| 53 | operations.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#::Rotaterust-analyzer cargo glycin-common 1.0.4 operations/Operation#Rotate#(rotate)); |
| 54 | } |
| 55 | |
| 56 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations] { |
| 57 | operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations., |
| 58 | unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#unknown_operations.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /// Prepend operations |
| 63 | /// |
| 64 | /// ``` |
| 65 | /// # use glycin_common::{Operation, Operations}; |
| 66 | /// # use gufo_common::orientation::{Orientation, Rotation}; |
| 67 | /// let mut ops = Operations::new(vec![Operation::MirrorVertically]); |
| 68 | /// ops.prepend(Operations::new_orientation(Orientation::Rotation90)); |
| 69 | /// |
| 70 | /// assert_eq!( |
| 71 | /// ops.operations(), |
| 72 | /// &[ |
| 73 | /// Operation::Rotate(Rotation::_90), |
| 74 | /// Operation::MirrorVertically |
| 75 | /// ] |
| 76 | /// ); |
| 77 | /// ``` |
| 78 | pub fn prependrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]prepend().(&mut self, mut operations: Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#) { |
| 79 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::swaprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/swap().(self, &mut operations); |
| 80 | self.operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations..appendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]append().(&mut operations.operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations.); |
| 81 | } |
| 82 | |
| 83 | pub fn from_readrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]from_read().(reader: impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations], rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::decoderust-analyzer cargo rmp-serde 1.3.1 decode/::Errorrust-analyzer cargo rmp-serde 1.3.1 decode/Error#> { |
| 84 | rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::decoderust-analyzer cargo rmp-serde 1.3.1 decode/::from_readrust-analyzer cargo rmp-serde 1.3.1 decode/from_read().(reader) |
| 85 | } |
| 86 | |
| 87 | pub fn from_slicerust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]from_slice().(slice: impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations], rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::decoderust-analyzer cargo rmp-serde 1.3.1 decode/::Errorrust-analyzer cargo rmp-serde 1.3.1 decode/Error#> { |
| 88 | rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::decoderust-analyzer cargo rmp-serde 1.3.1 decode/::from_slicerust-analyzer cargo rmp-serde 1.3.1 decode/from_slice().(slice.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()) |
| 89 | } |
| 90 | |
| 91 | pub fn to_message_packrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]to_message_pack().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::encoderust-analyzer cargo rmp-serde 1.3.1 encode/::Errorrust-analyzer cargo rmp-serde 1.3.1 encode/Error#> { |
| 92 | let mut buf = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 93 | self.serializerust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations][Serialize]serialize().(&mut rmp_serderust-analyzer cargo rmp-serde 1.3.1 crate/::Serializerrust-analyzer cargo rmp-serde 1.3.1 encode/Serializer#::newrust-analyzer cargo rmp-serde 1.3.1 encode/impl#[`Serializer<W>`]new().(&mut buf).with_human_readablerust-analyzer cargo rmp-serde 1.3.1 encode/impl#[`Serializer<W, C>`]with_human_readable().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 94 | |
| 95 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(buf) |
| 96 | } |
| 97 | |
| 98 | pub fn operationsrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]operations().(&self) -> &[Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#] { |
| 99 | &self.operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations. |
| 100 | } |
| 101 | |
| 102 | pub fn operation_idsrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]operation_ids().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#> { |
| 103 | self.operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| x.idrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]id().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 104 | } |
| 105 | |
| 106 | /// Returns information about all operations that were unknown when |
| 107 | /// deserializing |
| 108 | pub fn unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]unknown_operations().(&self) -> &[Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#] { |
| 109 | &self.unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#unknown_operations. |
| 110 | } |
| 111 | |
| 112 | /// Returns an [`Orientation`] if all operations can be reduced to that |
| 113 | /// |
| 114 | /// ``` |
| 115 | /// # use glycin_common::{Operations, Operation}; |
| 116 | /// # use gufo_common::orientation::{Rotation, Orientation}; |
| 117 | /// assert_eq!( |
| 118 | /// Operations::new(vec![ |
| 119 | /// Operation::Rotate(Rotation::_180), |
| 120 | /// Operation::Rotate(Rotation::_270) |
| 121 | /// ]) |
| 122 | /// .orientation(), |
| 123 | /// Some(Orientation::Rotation90) |
| 124 | /// ); |
| 125 | /// |
| 126 | /// assert_eq!( |
| 127 | /// Operations::new(vec![ |
| 128 | /// Operation::Rotate(Rotation::_90), |
| 129 | /// Operation::MirrorHorizontally |
| 130 | /// ]) |
| 131 | /// .orientation(), |
| 132 | /// Some(Orientation::MirroredRotation270) |
| 133 | /// ); |
| 134 | /// |
| 135 | /// assert_eq!( |
| 136 | /// Operations::new(vec![ |
| 137 | /// Operation::MirrorHorizontally, |
| 138 | /// Operation::MirrorVertically, |
| 139 | /// Operation::Rotate(Rotation::_270), |
| 140 | /// Operation::MirrorHorizontally, |
| 141 | /// ]) |
| 142 | /// .orientation(), |
| 143 | /// Some(Orientation::MirroredRotation270) |
| 144 | /// ); |
| 145 | /// ``` |
| 146 | pub fn orientationrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations]orientation().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orientationrust-analyzer cargo gufo-common 1.1.0 orientation/Orientation#> { |
| 147 | let mut orientation = Orientationrust-analyzer cargo gufo-common 1.1.0 orientation/Orientation#::Idrust-analyzer cargo gufo-common 1.1.0 orientation/Orientation#Id#; |
| 148 | |
| 149 | for operation in &self.operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations. { |
| 150 | match operation { |
| 151 | Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#::MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorHorizontally# => { |
| 152 | orientation = orientation.add_mirror_horizontallyrust-analyzer cargo gufo-common 1.1.0 orientation/impl#[Orientation]add_mirror_horizontally().(); |
| 153 | } |
| 154 | Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#::MirrorVerticallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorVertically# => { |
| 155 | orientation = orientation.add_mirror_verticallyrust-analyzer cargo gufo-common 1.1.0 orientation/impl#[Orientation]add_mirror_vertically().(); |
| 156 | } |
| 157 | Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#::Rotaterust-analyzer cargo glycin-common 1.0.4 operations/Operation#Rotate#(rotation) => { |
| 158 | orientation = orientation.add_rotationrust-analyzer cargo gufo-common 1.1.0 orientation/impl#[Orientation]add_rotation().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().rotation); |
| 159 | } |
| 160 | _ => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(orientation) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<OperationsIntermediaterust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate#> for Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 169 | fn fromrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operations][`From<OperationsIntermediate>`]from().(operations: OperationsIntermediaterust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate#) -> Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 170 | Operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations# { |
| 171 | operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#operations.: operations |
| 172 | .operationsrust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate#operations. |
| 173 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 174 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|x| x.operationrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]operation().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]cloned().()) |
| 175 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 176 | |
| 177 | unknown_operationsrust-analyzer cargo glycin-common 1.0.4 operations/Operations#unknown_operations.: operations |
| 178 | .operationsrust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate#operations. |
| 179 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 180 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|x| x.unknownrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]unknown().()) |
| 181 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | /// Decoding format that allows to decode without failing for unknown operations |
| 187 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:)] |
| 188 | struct OperationsIntermediaterust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate# { |
| 189 | operationsrust-analyzer cargo glycin-common 1.0.4 operations/OperationsIntermediate#operations.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<MaybeOperationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#>, |
| 190 | } |
| 191 | |
| 192 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 193 | enum MaybeOperationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation# { |
| 194 | Operationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Operation#(Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#), |
| 195 | Unknownrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Unknown#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 196 | } |
| 197 | |
| 198 | impl MaybeOperationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation# { |
| 199 | fn operationrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]operation().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation#> { |
| 200 | match self { |
| 201 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]::Operationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Operation#(operation) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(operation), |
| 202 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]::Unknownrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Unknown#(_) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | fn unknownrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]unknown().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 207 | match self { |
| 208 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]::Operationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Operation#(_) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 209 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation]::Unknownrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Unknown#(s) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | impl<'de> Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> for MaybeOperationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation# { |
| 215 | fn deserializerust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation][`Deserialize<'de>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MaybeOperationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#, D::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#> |
| 216 | where |
| 217 | D: Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de>, |
| 218 | { |
| 219 | match serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#::deserializerust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation][`Deserialize<'de>`]deserialize().(deserializer) { |
| 220 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation][`Deserialize<'de>`]::Operationrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Operation#(val)), |
| 221 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[MaybeOperation][`Deserialize<'de>`]::Unknownrust-analyzer cargo glycin-common 1.0.4 operations/MaybeOperation#Unknown#(err.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | impl Operationrust-analyzer cargo glycin-common 1.0.4 operations/Operation# { |
| 227 | pub fn idrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]id().(&self) -> OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId# { |
| 228 | match self { |
| 229 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]::Cliprust-analyzer cargo glycin-common 1.0.4 operations/Operation#Clip#(_) => OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#::Cliprust-analyzer cargo glycin-common 1.0.4 operations/OperationId#Clip#, |
| 230 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]::MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorHorizontally# => OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#::MirrorHorizontallyrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#MirrorHorizontally#, |
| 231 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]::MirrorVerticallyrust-analyzer cargo glycin-common 1.0.4 operations/Operation#MirrorVertically# => OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#::MirrorVerticallyrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#MirrorVertically#, |
| 232 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[Operation]::Rotaterust-analyzer cargo glycin-common 1.0.4 operations/Operation#Rotate#(_) => OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId#::Rotaterust-analyzer cargo glycin-common 1.0.4 operations/OperationId#Rotate#, |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for OperationIdrust-analyzer cargo glycin-common 1.0.4 operations/OperationId# { |
| 238 | type Errrust-analyzer cargo glycin-common 1.0.4 operations/impl#[OperationId][FromStr]Err# = valuerust-analyzer cargo serde_core 1.0.228 de/value/::Errorrust-analyzer cargo serde_core 1.0.228 de/value/Error#; |
| 239 | |
| 240 | /// ``` |
| 241 | /// # use glycin_common::OperationId; |
| 242 | /// # use std::str::FromStr; |
| 243 | /// let id = OperationId::from_str("Clip").unwrap(); |
| 244 | /// assert_eq!(id, OperationId::Clip) |
| 245 | /// ``` |
| 246 | fn from_strrust-analyzer cargo glycin-common 1.0.4 operations/impl#[OperationId][FromStr]from_str().(slice: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[OperationId][FromStr], valuerust-analyzer cargo serde_core 1.0.228 de/value/::Errorrust-analyzer cargo serde_core 1.0.228 de/value/Error#> { |
| 247 | Selfrust-analyzer cargo glycin-common 1.0.4 operations/impl#[OperationId][FromStr]::deserializerust-analyzer cargo glycin-common 1.0.4 operations/impl#[OperationId][`Deserialize<'de>`]deserialize().(slice.into_deserializerrust-analyzer cargo serde_core 1.0.228 de/value/impl#[`&'a str`][`IntoDeserializer<'de, E>`]into_deserializer().()) |
| 248 | } |
| 249 | } |