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 title;
|
||||||
mod widget;
|
mod widget;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Label {
|
pub struct Label {
|
||||||
|
// Components
|
||||||
|
pin: Arc<pin::Pin>,
|
||||||
|
title: Arc<title::Title>,
|
||||||
|
|
||||||
|
// Extras
|
||||||
widget: widget::Label,
|
widget: widget::Label,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Label {
|
impl Label {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Label {
|
pub fn new() -> Arc<Label> {
|
||||||
Self {
|
// Init components
|
||||||
widget: widget::Label::new(
|
let pin = pin::Pin::new();
|
||||||
pin::Pin::new().widget().image(),
|
let title = title::Title::new();
|
||||||
title::Title::new().widget().label(),
|
|
||||||
),
|
// Init extras
|
||||||
}
|
let widget = widget::Label::new(pin.widget().image(), title.widget().label());
|
||||||
|
|
||||||
|
// Result
|
||||||
|
Arc::new(Self { pin, title, widget })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
mod widget;
|
mod widget;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Pin {
|
pub struct Pin {
|
||||||
widget: widget::Pin,
|
widget: widget::Pin,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pin {
|
impl Pin {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Pin {
|
pub fn new() -> Arc<Pin> {
|
||||||
Self {
|
Arc::new(Self {
|
||||||
widget: widget::Pin::new(),
|
widget: widget::Pin::new(),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
mod widget;
|
mod widget;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Title {
|
pub struct Title {
|
||||||
widget: widget::Title,
|
widget: widget::Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Title {
|
impl Title {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Title {
|
pub fn new() -> Arc<Title> {
|
||||||
Self {
|
Arc::new(Self {
|
||||||
widget: widget::Title::new(),
|
widget: widget::Title::new(),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue