Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer<W: CustomWidget> { /* private fields */ }
Expand description

A widget’s renders on the current platform: native, drawn or composed. The first one present is used: native, then drawn, then composed. The others stay available (for headless tests, .drawn(), .composed()).

Implementations§

Source§

impl<W: CustomWidget> Renderer<W>

Source

pub fn drawn() -> Renderer<W>
where W: Drawn,

Draws the widget with its Drawn implementation.

Source

pub fn native(render: Opaque) -> Renderer<W>

For backend crates: a native render that is the platform’s own control, in whatever form the backend understands. Apps use the backend’s constructor instead.

Source

pub fn ad_hoc(render: Opaque) -> Renderer<W>

For backend crates: a render built ad hoc from the platform’s widgets, where the platform has no such control. It’s rendered like a native one, but is_native says no.

Source

pub fn with_drawn(self) -> Renderer<W>
where W: Drawn,

Keeps the drawn render too: headless tests lay the widget out with it, and Custom::drawn can pick it.

Source

pub fn composed<V: View>( compose: impl Fn(Composed<W>) -> V + 'static, ) -> Renderer<W>

Composes the widget from built-in widgets: the tier for widgets the canvas can’t draw.

Source

pub fn with_composed<V: View>( self, compose: impl Fn(Composed<W>) -> V + 'static, ) -> Renderer<W>

Keeps a composed render too, for Custom::composed.

Source

pub fn is_native(&self) -> bool

Whether the widget is the platform’s own control here (rather than built ad hoc, drawn or composed as a stand-in).

Auto Trait Implementations§

§

impl<W> !RefUnwindSafe for Renderer<W>

§

impl<W> !Send for Renderer<W>

§

impl<W> !Sync for Renderer<W>

§

impl<W> !UnwindSafe for Renderer<W>

§

impl<W> Forget for Renderer<W>

§

impl<W> Freeze for Renderer<W>
where &'static str: Freeze, *const RcInner<dyn Any> is !null: Freeze, PhantomData<RcInner<dyn Any>>: Freeze, *const RcInner<dyn Fn(Composed<W>) -> AnyView> is !null: Freeze, PhantomData<RcInner<dyn Fn(Composed<W>) -> AnyView>>: Freeze,

§

impl<W> Move for Renderer<W>

§

impl<W> Unpin for Renderer<W>
where &'static str: Unpin, Rc<dyn Any>: Unpin, Rc<dyn Fn(Composed<W>) -> AnyView>: Unpin,

§

impl<W> UnsafeUnpin for Renderer<W>
where &'static str: UnsafeUnpin, *const RcInner<dyn Any> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Any>>: UnsafeUnpin, *const RcInner<dyn Fn(Composed<W>) -> AnyView> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Composed<W>) -> AnyView>>: 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.