pub struct TitleCard;Expand description
A stylish display-only component for application titles.
Renders a centered title with optional decorations, subtitle, and borders. This is a display-only component that does not receive keyboard focus.
§Example
use envision::component::{Component, TitleCard, TitleCardState};
let state = TitleCardState::new("My Application")
.with_subtitle("v1.0.0")
.with_prefix("🎯 ");
assert_eq!(state.title(), "My Application");
assert_eq!(state.subtitle(), Some("v1.0.0"));Trait Implementations§
Source§impl Component for TitleCard
impl Component for TitleCard
Source§type State = TitleCardState
type State = TitleCardState
The component’s internal state type. Read more
Source§type Message = TitleCardMessage
type Message = TitleCardMessage
Messages this component can receive. Read more
Source§fn update(state: &mut Self::State, msg: Self::Message) -> Option<Self::Output>
fn update(state: &mut Self::State, msg: Self::Message) -> Option<Self::Output>
Update component state based on a message. Read more
Source§fn view(
state: &Self::State,
frame: &mut Frame<'_>,
area: Rect,
theme: &Theme,
ctx: &ViewContext,
)
fn view( state: &Self::State, frame: &mut Frame<'_>, area: Rect, theme: &Theme, ctx: &ViewContext, )
Render the component to the given area. Read more
Source§fn traced_view(
state: &Self::State,
frame: &mut Frame<'_>,
area: Rect,
theme: &Theme,
ctx: &ViewContext,
)
fn traced_view( state: &Self::State, frame: &mut Frame<'_>, area: Rect, theme: &Theme, ctx: &ViewContext, )
Renders the component with optional tracing instrumentation. Read more
Source§fn handle_event(
state: &Self::State,
event: &Event,
ctx: &ViewContext,
) -> Option<Self::Message>
fn handle_event( state: &Self::State, event: &Event, ctx: &ViewContext, ) -> Option<Self::Message>
Maps an input event to a component message. Read more
Source§fn dispatch_event(
state: &mut Self::State,
event: &Event,
ctx: &ViewContext,
) -> Option<Self::Output>
fn dispatch_event( state: &mut Self::State, event: &Event, ctx: &ViewContext, ) -> Option<Self::Output>
Dispatches an event by mapping it to a message and updating state. Read more
Auto Trait Implementations§
impl Freeze for TitleCard
impl RefUnwindSafe for TitleCard
impl Send for TitleCard
impl Sync for TitleCard
impl Unpin for TitleCard
impl UnsafeUnpin for TitleCard
impl UnwindSafe for TitleCard
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more