pub struct Button {
pub id: &'static str,
/* private fields */
}Expand description
A struct of button for interact with the GUI.
Fields§
§id: &'static strThe id is not unique, it’s just a name to identify it.
Implementations§
Source§impl Button
impl Button
Sourcepub fn new(
id: &'static str,
enable: bool,
rect: Rect,
color: Color,
text: &'static str,
align: Align,
func: Option<fn(&mut ChessGui)>,
) -> Self
pub fn new( id: &'static str, enable: bool, rect: Rect, color: Color, text: &'static str, align: Align, func: Option<fn(&mut ChessGui)>, ) -> Self
Create a new Button.
Sourcepub fn set_image(&mut self, path: Option<&'static str>) -> Self
pub fn set_image(&mut self, path: Option<&'static str>) -> Self
Draw the image at the given path rather than a rectangle.
Trait Implementations§
impl Copy for Button
Auto Trait Implementations§
impl Freeze for Button
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnwindSafe for Button
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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