[][src]Struct coffee::ui::widget::radio::Radio

pub struct Radio<Message> { /* fields omitted */ }

A circular button representing a choice.

It implements Widget when the core::Renderer implements the radio::Renderer trait.


use coffee::graphics::Color;
use coffee::ui::{Column, Radio};

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Choice {

#[derive(Debug, Clone, Copy)]
pub enum Message {

let selected_choice = Some(Choice::A);

        Radio::new(Choice::A, "This is A", selected_choice, Message::RadioSelected)
        Radio::new(Choice::B, "This is B", selected_choice, Message::RadioSelected)

Checkbox drawn by the built-in renderer


impl<Message> Radio<Message>[src]

pub fn new<F, V>(value: V, label: &str, selected: Option<V>, f: F) -> Self where
    V: Eq + Copy,
    F: 'static + Fn(V) -> Message, 

Creates a new Radio button.

It expects:

  • the value related to the Radio button
  • the label of the Radio button
  • the current selected value
  • a function that will be called when the Radio is selected. It receives the value of the radio and must produce a Message.

pub fn label_color(self, color: Color) -> Self[src]

Sets the Color of the label of the Radio.

Trait Implementations

impl<Message> Debug for Radio<Message> where
    Message: Debug

impl<'a, Message, Renderer> From<Radio<Message>> for Element<'a, Message, Renderer> where
    Renderer: Renderer + Renderer,
    Message: 'static + Copy + Debug

impl<Message, Renderer> Widget<Message, Renderer> for Radio<Message> where
    Renderer: Renderer + Renderer,
    Message: Copy + Debug

Auto Trait Implementations

impl<Message> RefUnwindSafe for Radio<Message> where
    Message: RefUnwindSafe

impl<Message> Send for Radio<Message> where
    Message: Send

impl<Message> Sync for Radio<Message> where
    Message: Sync

impl<Message> Unpin for Radio<Message> where
    Message: Unpin

impl<Message> UnwindSafe for Radio<Message> where
    Message: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SetParameter for T

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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