Struct uefi::proto::console::text::Output

source ·
pub struct Output(/* private fields */);
Expand description

Interface for text-based output devices.

It implements the fmt::Write trait, so you can use it to print text with standard Rust constructs like the write!() and writeln!() macros.

§Accessing Output protocol

The standard output and standard error output protocols can be accessed using SystemTable::stdout and SystemTable::stderr, respectively.

An Output protocol can also be accessed like any other UEFI protocol. See the BootServices documentation for more details of how to open a protocol.

Implementations§

source§

impl Output

source

pub fn reset(&mut self, extended: bool) -> Result

Resets and clears the text output device hardware.

source

pub fn clear(&mut self) -> Result

Clears the output screen.

The background is set to the current background color. The cursor is moved to (0, 0).

source

pub fn output_string(&mut self, string: &CStr16) -> Result

Writes a string to the output device.

source

pub fn output_string_lossy(&mut self, string: &CStr16) -> Result

Writes a string to the output device. If the string contains unknown characters that cannot be rendered they will be silently skipped.

source

pub fn test_string(&mut self, string: &CStr16) -> Result<bool>

Checks if a string contains only supported characters.

UEFI applications are encouraged to try to print a string even if it contains some unsupported characters.

source

pub fn modes(&mut self) -> OutputModeIter<'_>

Returns an iterator of all supported text modes.

source

pub fn current_mode(&self) -> Result<Option<OutputMode>>

Returns the current text mode.

source

pub fn set_mode(&mut self, mode: OutputMode) -> Result

Sets a mode as current.

source

pub const fn cursor_visible(&self) -> bool

Returns whether the cursor is currently shown or not.

source

pub fn enable_cursor(&mut self, visible: bool) -> Result

Make the cursor visible or invisible.

The output device may not support this operation, in which case an Unsupported error will be returned.

source

pub const fn cursor_position(&self) -> (usize, usize)

Returns the column and row of the cursor.

source

pub fn set_cursor_position(&mut self, column: usize, row: usize) -> Result

Sets the cursor’s position, relative to the top-left corner, which is (0, 0).

This function will fail if the cursor’s new position would exceed the screen’s bounds.

source

pub fn set_color(&mut self, foreground: Color, background: Color) -> Result

Sets the text and background colors for the console.

Note that for the foreground color you can choose any color. The background must be one of the first 8 colors.

Trait Implementations§

source§

impl Debug for Output

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Identify for Output

source§

const GUID: Guid = SimpleTextOutputProtocol::GUID

Unique protocol identifier.
source§

impl Write for Output

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
source§

impl Protocol for Output

Auto Trait Implementations§

§

impl Freeze for Output

§

impl RefUnwindSafe for Output

§

impl !Send for Output

§

impl !Sync for Output

§

impl Unpin for Output

§

impl UnwindSafe for Output

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<P> ProtocolPointer for P
where P: Protocol,

source§

unsafe fn ptr_from_ffi(ptr: *const c_void) -> *const P

Create a const pointer to a Protocol from a c_void pointer. Read more
source§

unsafe fn mut_ptr_from_ffi(ptr: *mut c_void) -> *mut P

Create a mutable pointer to a Protocol from a c_void pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.