Skip to main content

EmojiSource

Trait EmojiSource 

pub trait EmojiSource {
    // Required methods
    fn emoji(&self) -> Rc<WorkspaceEmoji>;
    fn revision(&self) -> u64;
    fn can_manage(&self) -> bool;
    fn add(&self, name: &str, image: &[u8]) -> Result<(), String>;
    fn remove(&self, name: &str) -> Result<(), String>;
    fn choose_and_add(&self);

    // Provided method
    fn last_added(&self) -> (u64, Option<Adding>) { ... }
}
Expand description

What a window’s host offers its views of the workspace’s emoji: the workspace’s emoji record, opened for the window.

Required Methods§

fn emoji(&self) -> Rc<WorkspaceEmoji>

The emoji now.

fn revision(&self) -> u64

Moves whenever the emoji changed: a view that drew them repaints.

fn can_manage(&self) -> bool

Whether the person may add and remove the workspace’s emoji.

fn add(&self, name: &str, image: &[u8]) -> Result<(), String>

Add image (PNG, JPEG or WebP of any size) as the emoji name: made small first (IMAGE_SIDE, MAX_IMAGE_BYTES), then added by the record’s action, attributed to the person.

§Errors

Why it was not added: no grant, a name taken or not allowed, a picture that does not decode or stays too large.

fn remove(&self, name: &str) -> Result<(), String>

Remove the emoji name.

§Errors

Why it was not removed.

fn choose_and_add(&self)

Let the person choose a picture and add it as an emoji named after it, as the picker’s “Add emoji” does. The host’s chooser answers later; the emoji arrives with the record’s next change.

Provided Methods§

fn last_added(&self) -> (u64, Option<Adding>)

What became of the last picture chosen with Self::choose_and_add, once it was added or refused, with a count that moves each time one is: the picker shows the new emoji, or why it was not added. (0, None) until one was.

Implementors§