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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
pub fn on_key(&mut self, c: char) {
match c {
'q' => {
self.should_quit = true;
}
't' => {
self.show_images = match self.show_images {
ShowImages::All => ShowImages::Fixed,
ShowImages::Fixed => ShowImages::Resized,
ShowImages::Resized => ShowImages::All,
}
}
'i' => {
self.picker
.set_protocol_type(self.picker.protocol_type().next());
self.reset_images();
}
'o' => {
let path = match self.image_source_path.to_str() {
Some("./assets/Ada.png") => "./assets/Jenkins.jpg",
Some("./assets/Jenkins.jpg") => "./assets/NixOS.png",
_ => "./assets/Ada.png",
};
self.image_source = image::io::Reader::open(path).unwrap().decode().unwrap();
self.image_source_path = path.into();
self.reset_images();
}
'H' => {
if self.split_percent >= 10 {
self.split_percent -= 10;
}
}
'L' => {
if self.split_percent <= 90 {
self.split_percent += 10;
}
}
'h' => {
if self.image_static_offset.0 > 0 {
self.image_static_offset.0 -= 1;
}
}
'j' => {
self.image_static_offset.1 += 1;
}
'k' => {
if self.image_static_offset.1 > 0 {
self.image_static_offset.1 -= 1;
}
}
'l' => {
self.image_static_offset.0 += 1;
}
_ => {}
}
}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