Struct ChipEdit

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

Creates a chip style textbox Press backspace in empty chip deletes it Lost focus from empty chip deletes it

Implementations§

Source§

impl ChipEdit

Source

pub fn default_widget_bg_color(ui: &Ui) -> Color32

Returns the default background color for the widget

Source

pub fn default_widget_fg_color(ui: &Ui) -> Color32

Returns the default foreground color for the widget

Source

pub fn new(separator: &str) -> Result<Self, String>

Creates a new ChipEdit with the specified separator.

§Arguments
  • separator - The separator string used to split chip texts.
§Errors

Returns an error if the separator is empty.

Source

pub fn show(&mut self, ui: &mut Ui) -> ChipEditOutput

Displays the ChipEdit widget in the given UI.

§Arguments
  • ui - The UI to display the widget in.
§Returns

A ChipEditOutput containing the result of the widget interaction.

Source

pub fn set_text(&mut self, texts: impl IntoIterator<Item = impl ToString>)

Sets the texts for the chips.

§Arguments
  • texts - An iterator of strings representing the texts for the chips.
Source

pub fn values(&self) -> Vec<String>

Returns the current values of the chips.

§Returns

A vector of strings representing the current values of the chips.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for ChipEdit

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ChipEdit

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Widget for &mut ChipEdit

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations§

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 = 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,