Skip to main content

HeadlessBackend

Struct HeadlessBackend 

Source
pub struct HeadlessBackend { /* private fields */ }
Expand description

The backend. Hand it to Ui::new; keep a HeadlessHandle to inspect it afterwards.

Implementations§

Trait Implementations§

Source§

impl Backend for HeadlessBackend

Source§

fn init(&mut self, events: EventSink)

Called once when the backend is attached to a Ui.
Source§

fn metrics(&self) -> PlatformMetrics

Source§

fn apply(&mut self, batch: &[Command])

Applies a batch of commands to the native tree.
Source§

fn measure(&mut self, id: NodeId, request: MeasureRequest) -> Size

Intrinsic size of a leaf widget. Called synchronously during layout, after all commands of the current batch have been applied.
Source§

fn perform( &mut self, id: NodeId, action: &A11yAction, ) -> Result<(), ActionError>

Performs an accessibility action on the native control, as assistive technology would. Resulting events go through the EventSink.
Source§

fn synthesize( &mut self, id: NodeId, input: &SyntheticInput, ) -> Result<(), ActionError>

Synthesizes raw user input on a native control, as close to real input as the platform allows. Used by end-to-end tests.
Source§

fn native_state(&self, id: NodeId) -> Option<NativeState>

Source§

fn work_area(&self, _window: Option<NodeId>) -> Option<Size>

The work area of a window’s screen (the screen less its bars and docks), as the content size of a window filling it, in points; with None, of the screen a new window opens on. None if the platform can’t tell (no screen).
Source§

fn locale(&self) -> Rc<dyn PlatformLocale>

The user’s languages, and how the user’s region writes numbers and dates. Called once, when the backend is attached.
Source§

fn set_locale(&mut self, language: &LanguageIdentifier, right_to_left: bool)

The app’s language, which the core chose from the user’s, and whether it’s written right to left: set before the app’s first window, and again when the app changes it. Make the toolkit’s own chrome follow it where the platform lets an app choose (the direction of title bars, menus and dialogs). Native widgets get their direction as Prop::LayoutDirection.
Source§

fn capture(&mut self, _id: NodeId, reply: Reply<Result<Image, CaptureError>>)

Offscreen screenshot of a window or node. Async because some platforms render asynchronously (WinUI’s RenderTargetBitmap); reply whenever it’s ready, right away if possible.
Source§

fn services(&self) -> Box<dyn Services>

The platform’s clipboard, dialogs and menus. Called once, when the backend is attached; tests may replace the result.
Source§

fn set_app_info(&mut self, info: &AppInfo)

The app’s id, name and icon, set before the app’s first window, and perhaps again later (tests). Apply what the platform has a place for, to the windows there are and those to come.
Source§

fn group_insets(&self, _id: NodeId) -> Option<Insets>

Where this Group puts its content, if not where the metrics’ group_insets or titled_group_insets say: a tweak can move its heading or change its border. Asked when the group is measured.
Source§

fn tab_insets(&self, _id: NodeId) -> Option<Insets>

Where this Tabs puts its pages, if not where the metrics’ tab_insets say: its style can give it another strip. Asked when its strip is measured.
Source§

impl Default for HeadlessBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for HeadlessBackend

§

impl !Send for HeadlessBackend

§

impl !Sync for HeadlessBackend

§

impl !UnwindSafe for HeadlessBackend

§

impl Forget for HeadlessBackend

§

impl Freeze for HeadlessBackend
where *const RcInner<RefCell<State>> is !null: Freeze, PhantomData<RcInner<RefCell<State>>>: Freeze,

§

impl Move for HeadlessBackend

§

impl Unpin for HeadlessBackend
where Rc<RefCell<State>>: Unpin,

§

impl UnsafeUnpin for HeadlessBackend
where *const RcInner<RefCell<State>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<State>>>: UnsafeUnpin,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.