pub enum ProtocolType {
Halfblocks,
Sixel,
Kitty,
Iterm2,
}Expand description
Serde-friendly protocol-type enum for Picker.
Variants§
Implementations§
Source§impl ProtocolType
impl ProtocolType
Sourcepub fn next(&self) -> ProtocolType
pub fn next(&self) -> ProtocolType
Examples found in repository?
examples/demo/main.rs (line 144)
130 pub fn on_key(&mut self, c: char) {
131 match c {
132 'q' => {
133 self.should_quit = true;
134 }
135 't' => {
136 self.show_images = match self.show_images {
137 ShowImages::All => ShowImages::Fixed,
138 ShowImages::Fixed => ShowImages::Resized,
139 ShowImages::Resized => ShowImages::All,
140 }
141 }
142 'i' => {
143 self.picker
144 .set_protocol_type(self.picker.protocol_type().next());
145 self.reset_images();
146 }
147 'o' => {
148 let path = match self.image_source_path.to_str() {
149 Some("./assets/Ada.png") => "./assets/Jenkins.jpg",
150 Some("./assets/Jenkins.jpg") => "./assets/NixOS.png",
151 _ => "./assets/Ada.png",
152 };
153 self.image_source = image::io::Reader::open(path).unwrap().decode().unwrap();
154 self.image_source_path = path.into();
155 self.reset_images();
156 }
157 'H' => {
158 if self.split_percent >= 10 {
159 self.split_percent -= 10;
160 }
161 }
162 'L' => {
163 if self.split_percent <= 90 {
164 self.split_percent += 10;
165 }
166 }
167 'h' => {
168 if self.image_static_offset.0 > 0 {
169 self.image_static_offset.0 -= 1;
170 }
171 }
172 'j' => {
173 self.image_static_offset.1 += 1;
174 }
175 'k' => {
176 if self.image_static_offset.1 > 0 {
177 self.image_static_offset.1 -= 1;
178 }
179 }
180 'l' => {
181 self.image_static_offset.0 += 1;
182 }
183 _ => {}
184 }
185 }Trait Implementations§
Source§impl Clone for ProtocolType
impl Clone for ProtocolType
Source§fn clone(&self) -> ProtocolType
fn clone(&self) -> ProtocolType
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProtocolType
impl Debug for ProtocolType
Source§impl PartialEq for ProtocolType
impl PartialEq for ProtocolType
impl Copy for ProtocolType
impl StructuralPartialEq for ProtocolType
Auto Trait Implementations§
impl Freeze for ProtocolType
impl RefUnwindSafe for ProtocolType
impl Send for ProtocolType
impl Sync for ProtocolType
impl Unpin for ProtocolType
impl UnwindSafe for ProtocolType
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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