Skip to main content

Switch

Struct Switch 

Source
pub struct Switch {
Show 14 fields pub appearance: Vec<SwitchAppearanceConfig>, pub background_type: BackgroundType, pub text_config: TextConfig, pub hint_text_config: TextConfig, pub enable_animation: [bool; 2], pub state_amount: u32, pub click_method: Vec<SwitchClickConfig>, pub enable: bool, pub state: u32, pub last_frame_hovered: bool, pub last_frame_clicked: Option<usize>, pub switched: bool, pub use_switch_tags: bool, pub tags: Vec<[String; 2]>,
}
Expand description

RC的开关资源。

Fields§

§appearance: Vec<SwitchAppearanceConfig>

外观(包括各类资源配置项,数量为开启的内容数量*Switch状态总数)。

§background_type: BackgroundType

Background显示内容类型。

§text_config: TextConfig

Text显示配置。

§hint_text_config: TextConfig

提示Text显示配置。

§enable_animation: [bool; 2]

是否启用鼠标悬浮和点击时的显示内容。

§state_amount: u32

Switch状态总数。

§click_method: Vec<SwitchClickConfig>

可以用于点击Switch的方法。

§enable: bool

是否启用Switch(不启用会显示出填充资源,但无法交互)。

§state: u32

Switch当前状态。

§last_frame_hovered: bool

上一帧是否有鼠标悬停。

§last_frame_clicked: Option<usize>

上一帧是否被鼠标点击。

§switched: bool

是否切换了Switch状态。

§use_switch_tags: bool

是否让创建的资源使用Switch的标签。

§tags: Vec<[String; 2]>

标签。

Implementations§

Source§

impl Switch

Source

pub fn appearance(self, appearance: &[SwitchAppearanceConfig]) -> Self

Source

pub fn background_type(self, background_type: &BackgroundType) -> Self

Source

pub fn text_config(self, text_config: &TextConfig) -> Self

Source

pub fn hint_text_config(self, hint_text_config: &TextConfig) -> Self

Source

pub fn enable_animation(self, enable_hover: bool, enable_click: bool) -> Self

Source

pub fn state_amount(self, state_amount: u32) -> Self

Source

pub fn click_method(self, click_method: Vec<SwitchClickConfig>) -> Self

Source

pub fn enable(self, enable: bool) -> Self

Source

pub fn use_switch_tags(self, use_switch_tags: bool) -> Self

Source

pub fn tags(self, tags: &[[String; 2]], replace: bool) -> Self

Trait Implementations§

Source§

impl Clone for Switch

Source§

fn clone(&self) -> Switch

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Switch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Switch

Source§

fn default() -> Self

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

impl PartialEq for Switch

Source§

fn eq(&self, other: &Switch) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RustConstructorResource for Switch

Source§

fn as_any(&self) -> &dyn Any

用于不可变类型转换。
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

用于可变类型转换。
Source§

fn display_display_info(&self) -> Option<DisplayInfo>

显示显示信息。
Source§

fn modify_display_info(&mut self, _display_info: DisplayInfo)

修改显示信息。
Source§

fn display_tags(&self) -> Vec<[String; 2]>

显示已有的标签。
Source§

fn modify_tags(&mut self, tags: &[[String; 2]], replace: bool)

修改已有的标签。
Source§

impl StructuralPartialEq for Switch

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,