pub struct ExitAttributeMode<'a>(/* private fields */);
Implementations§
Source§impl<'a> ExitAttributeMode<'a>
impl<'a> ExitAttributeMode<'a>
Sourcepub fn expand(&self) -> Expansion<'_, ExitAttributeMode<'_>>
pub fn expand(&self) -> Expansion<'_, ExitAttributeMode<'_>>
Begin expanding the capability.
Examples found in repository?
examples/set_attributes.rs (line 14)
4fn main() {
5 let info = Database::from_env().unwrap();
6
7 if let Some(set_attributes) = info.get::<cap::SetAttributes>() {
8 let clear = info.get::<cap::ExitAttributeMode>().unwrap();
9
10 set_attributes.expand().bold(true).underline(true).to(io::stdout()).unwrap();
11
12 println!("bold and underline");
13
14 clear.expand().to(io::stdout()).unwrap();
15 } else {
16 println!("The terminal does not support mass-setting attributes");
17 }
18}
More examples
examples/simple.rs (line 22)
4fn main() {
5 let info = Database::from_env().unwrap();
6
7 if let Some(cap::MaxColors(n)) = info.get::<cap::MaxColors>() {
8 println!("The terminal supports {} colors.", n);
9 } else {
10 println!("The terminal does not support colors, what year is this?");
11 }
12
13 if let Some(flash) = info.get::<cap::FlashScreen>() {
14 flash.expand().to(io::stdout()).unwrap();
15 } else {
16 println!("FLASH GORDON!");
17 }
18
19 info.get::<cap::SetAForeground>().unwrap().expand().color(2).to(io::stdout()).unwrap();
20 info.get::<cap::SetABackground>().unwrap().expand().color(4).to(io::stdout()).unwrap();
21 println!("SUP");
22 info.get::<cap::ExitAttributeMode>().unwrap().expand().to(io::stdout()).unwrap();
23}
Trait Implementations§
Source§impl<'a> AsRef<[u8]> for ExitAttributeMode<'a>
impl<'a> AsRef<[u8]> for ExitAttributeMode<'a>
Source§impl<'a> Capability<'a> for ExitAttributeMode<'a>
impl<'a> Capability<'a> for ExitAttributeMode<'a>
Source§impl<'a> Clone for ExitAttributeMode<'a>
impl<'a> Clone for ExitAttributeMode<'a>
Source§fn clone(&self) -> ExitAttributeMode<'a>
fn clone(&self) -> ExitAttributeMode<'a>
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<'a> Debug for ExitAttributeMode<'a>
impl<'a> Debug for ExitAttributeMode<'a>
Source§impl<'a> PartialEq for ExitAttributeMode<'a>
impl<'a> PartialEq for ExitAttributeMode<'a>
impl<'a> Eq for ExitAttributeMode<'a>
impl<'a> StructuralPartialEq for ExitAttributeMode<'a>
Auto Trait Implementations§
impl<'a> Freeze for ExitAttributeMode<'a>
impl<'a> RefUnwindSafe for ExitAttributeMode<'a>
impl<'a> Send for ExitAttributeMode<'a>
impl<'a> Sync for ExitAttributeMode<'a>
impl<'a> Unpin for ExitAttributeMode<'a>
impl<'a> UnwindSafe for ExitAttributeMode<'a>
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