mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update struct constructor
This commit is contained in:
parent
b162682f51
commit
3d7be25c5f
3 changed files with 27 additions and 13 deletions
|
|
@ -2,19 +2,29 @@ mod pin;
|
|||
mod title;
|
||||
mod widget;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Label {
|
||||
// Components
|
||||
pin: Arc<pin::Pin>,
|
||||
title: Arc<title::Title>,
|
||||
|
||||
// Extras
|
||||
widget: widget::Label,
|
||||
}
|
||||
|
||||
impl Label {
|
||||
// Construct
|
||||
pub fn new() -> Label {
|
||||
Self {
|
||||
widget: widget::Label::new(
|
||||
pin::Pin::new().widget().image(),
|
||||
title::Title::new().widget().label(),
|
||||
),
|
||||
}
|
||||
pub fn new() -> Arc<Label> {
|
||||
// Init components
|
||||
let pin = pin::Pin::new();
|
||||
let title = title::Title::new();
|
||||
|
||||
// Init extras
|
||||
let widget = widget::Label::new(pin.widget().image(), title.widget().label());
|
||||
|
||||
// Result
|
||||
Arc::new(Self { pin, title, widget })
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
mod widget;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Pin {
|
||||
widget: widget::Pin,
|
||||
}
|
||||
|
||||
impl Pin {
|
||||
// Construct
|
||||
pub fn new() -> Pin {
|
||||
Self {
|
||||
pub fn new() -> Arc<Pin> {
|
||||
Arc::new(Self {
|
||||
widget: widget::Pin::new(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
mod widget;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Title {
|
||||
widget: widget::Title,
|
||||
}
|
||||
|
||||
impl Title {
|
||||
// Construct
|
||||
pub fn new() -> Title {
|
||||
Self {
|
||||
pub fn new() -> Arc<Title> {
|
||||
Arc::new(Self {
|
||||
widget: widget::Title::new(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue