implements From<ControlFunction> for String

This commit is contained in:
Frank Zechert 2023-04-01 04:33:45 +02:00
parent 59bdca5c50
commit ad9146075b

View File

@ -29,14 +29,14 @@
//! //!
//! ``` //! ```
//! use ansi::c0::BEL; //! use ansi::c0::BEL;
//! print!("{}", BEL); //! println!("Let's ring the bell {}", BEL);
//! ``` //! ```
//! //!
//! Or to move the cursor to line 5, column 13: //! Or to move the cursor to line 5, column 13:
//! //!
//! ``` //! ```
//! use ansi::control_sequences::CUP; //! use ansi::control_sequences::CUP;
//! print!("{}", CUP(Some(5), Some(13))); //! print!("{}", CUP(5.into(), 13.into()));
//! ``` //! ```
//! //!
//! It might be necessary in some circumstances to announce the active set of control sequences before they can be used. //! It might be necessary in some circumstances to announce the active set of control sequences before they can be used.
@ -265,6 +265,12 @@ impl fmt::Debug for ControlFunction {
} }
} }
impl From<ControlFunction> for String {
fn from(control_function: ControlFunction) -> Self {
format!("{}", control_function)
}
}
pub mod c0; pub mod c0;
pub mod c1; pub mod c1;
pub mod control_sequences; pub mod control_sequences;