Skip to main content

App

Struct App 

Source
pub struct App {
Show 18 fields pub canvas: Canvas, pub cursor: Pos, pub mode: Mode, pub should_quit: bool, pub show_help: bool, pub help_tab: HelpTab, pub emoji_picker_open: bool, pub viewport: Rect, pub viewport_origin: Pos, pub selection_anchor: Option<Pos>, pub swatches: [Option<Swatch>; 5], pub floating: Option<FloatingSelection>, pub emoji_picker_state: EmojiPickerState, pub icon_catalog: Option<IconCatalogData>, pub swatch_body_hits: [Option<Rect>; 5], pub swatch_pin_hits: [Option<Rect>; 5], pub help_tab_hits: Vec<(HelpTab, Rect)>, pub help_scroll: u16, /* private fields */
}

Fields§

§canvas: Canvas§cursor: Pos§mode: Mode§should_quit: bool§show_help: bool§help_tab: HelpTab§emoji_picker_open: bool§viewport: Rect§viewport_origin: Pos§selection_anchor: Option<Pos>§swatches: [Option<Swatch>; 5]§floating: Option<FloatingSelection>§emoji_picker_state: EmojiPickerState§icon_catalog: Option<IconCatalogData>§swatch_body_hits: [Option<Rect>; 5]§swatch_pin_hits: [Option<Rect>; 5]§help_tab_hits: Vec<(HelpTab, Rect)>§help_scroll: u16

Implementations§

Source§

impl App

Source

pub fn new() -> Self

Source

pub fn new_remote( client: WebsocketClient, name: String, color: RgbColor, ) -> Self

Construct an App that talks to a remote dartboard server over ws instead of an in-proc ServerHandle. There is exactly one local user (the connected user); peer presence is tracked from server events.

Drains the server until Welcome is received (my_user_id set). This avoids a race where the first keystroke submits an op before the Welcome snapshot is applied — otherwise Welcome’s pre-join empty snapshot would stomp the user’s first paint.

Source

pub fn users(&self) -> &[LocalUser]

Source

pub fn active_user_index(&self) -> usize

Source

pub fn active_user_color(&self) -> RgbColor

Source

pub fn is_embedded(&self) -> bool

Source

pub fn peer_count(&self) -> usize

Total participants the server is aware of. Embedded: every LocalClient counts (all local users). Remote: our peers + us.

Source

pub fn set_viewport(&mut self, viewport: Rect)

Source

pub fn selection(&self) -> Option<Selection>

Source

pub fn toggle_pin(&mut self, idx: usize)

Source

pub fn clear_swatch(&mut self, idx: usize)

Source

pub fn activate_swatch(&mut self, idx: usize)

Source

pub fn tick(&mut self)

Source

pub fn handle_event(&mut self, event: Event)

Source

pub fn handle_intent(&mut self, intent: AppIntent) -> Vec<HostEffect>

Trait Implementations§

Source§

impl Default for App

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl !UnwindSafe for App

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V