Skip to main content

View

Struct View 

Source
pub struct View<M = ()> { /* private fields */ }
Expand description

A surface’s view: the root of each region (main, dock, layer). A region left out is not shown.

A node given for a region is the region root itself; a list (a Vec or an array) is wrapped in a col root. Tern draws a region’s children into an element of its own and ignores the root’s kind and props (but role), so a root should be a container. A bare node or list converts into a view as main’s children:

use tern_sdk::ui::{self, View};

let view: View = ui::md("**hi**").into();
let root = view.regions()[0].unwrap();
assert_eq!((root.kind(), root.child_nodes()[0].kind()), ("col", "md"));

Implementations§

Source§

impl<M> View<M>

Source

pub fn plain(&self, cols: usize) -> String

The view as plain text cols wide: what a program prints outside Tern. Works for views of any message type (see plain).

Examples found in repository?
examples/dashboard.rs (line 1124)
1121fn main() -> Result<(), tern_sdk::Error> {
1122	let mut dash = Dash::new();
1123	let Some(mut session) = Session::connect(Options::new().app("dashboard"))? else {
1124		print!("{}", dash.view(true).plain(100));
1125		return Ok(());
1126	};
1127	let sf = session.open(SurfaceOptions::screen().title("Fleet").font(Font::Sans))?;
1128	session.render(sf, dash.view(false))?;
1129	let mut next = Instant::now() + TICK;
1130	loop {
1131		let left = next.saturating_duration_since(Instant::now());
1132		match session.next(Some(left))? {
1133			None => {
1134				dash.tick();
1135				next = Instant::now() + TICK;
1136			},
1137			Some(Input::Msg(msg, _)) => dash.update(msg),
1138			Some(Input::Key(key)) => {
1139				if key.is("escape") && dash.confirming.is_some() {
1140					dash.update(Msg::Keep);
1141				} else if key.is("enter") && dash.confirming.is_some() {
1142					dash.update(Msg::Confirm);
1143				} else if key.is("escape") || key.is("q") || key.is("ctrl+c") {
1144					break;
1145				} else if key.is("tab") || key.is("]") {
1146					dash.page = dash.page.turn(false);
1147				} else if key.is("shift+tab") || key.is("[") {
1148					dash.page = dash.page.turn(true);
1149				} else if key.is("up") || key.is("k") {
1150					dash.pick(dash.page, -1);
1151				} else if key.is("down") || key.is("j") {
1152					dash.pick(dash.page, 1);
1153				} else if key.is("r") {
1154					dash.update(Msg::Refresh);
1155				} else if key.is("a") {
1156					dash.act_selected();
1157				} else if key.is("enter") {
1158					if let Some(id) = dash.selected[dash.page.index()] {
1159						dash.update(Msg::Open(dash.page, id.into()));
1160					}
1161				} else {
1162					continue;
1163				}
1164			},
1165			Some(Input::Event(_) | Input::Clipboard(_)) => continue,
1166		}
1167		session.render(sf, dash.view(false))?;
1168	}
1169	session.close()?;
1170	Ok(())
1171}
Source§

impl<M> View<M>

Source

pub fn new() -> Self

The empty view.

Examples found in repository?
examples/dashboard.rs (line 676)
667	fn view(&self, plain: bool) -> View<Msg> {
668		let main = nodes![self.head(), self.stats().key("stats"), self.nav(), self.body(plain)];
669		let mut dock: Vec<Node<Msg>> = Vec::new();
670		if let Some((page, id)) = self.confirming
671			&& let Some(risk) = self.risk(page, id)
672		{
673			dock.push(confirm(&risk).into());
674		}
675		dock.push(self.legend().into());
676		View::new().main(main).dock(dock)
677	}
More examples
Hide additional examples
examples/ask.rs (line 30)
28fn view() -> View<()> {
29	let sizes = SIZES.iter().map(|(value, label)| choice(value, label));
30	View::new().main([html::form().key("ask").child(
31		ui::card()
32			.key("card")
33			.head("Which size?")
34			.max(Bound::w(Extent::Ch(48.0)))
35			.child(ui::row().key("sizes").gap("lg").children(sizes))
36			.child(
37				ui::button("Create")
38					.key("go")
39					.variant("primary")
40					.actions(Actions::new().click("submit")),
41			),
42	)])
43}
examples/table.rs (line 55)
43fn view(entries: &[Entry]) -> View {
44	let rows = entries.iter().map(|e| {
45		let (name, icon) = if e.dir {
46			(format!("{}/", e.name), "folder")
47		} else {
48			(e.name.clone(), "file")
49		};
50		let size = if e.dir { "-".to_owned() } else { human(e.size) };
51		TableRow::new(e.name.clone())
52			.cell("name", TextCell::new(name).icon(icon))
53			.cell("size", size)
54	});
55	View::new().main([ui::table()
56		.col(Column::new("name", "Name").grow(1.0))
57		.col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58		.rows(rows.collect::<Vec<_>>())])
59}
examples/progress.rs (line 65)
40fn view(build: &Build) -> View {
41	let fraction = build.done as f64 / STEPS.len() as f64;
42	let running = build.took.is_none();
43	let activity: ui::Node = if running {
44		ui::spinner()
45			.style("dots")
46			.label(STEPS[build.done.min(STEPS.len() - 1)])
47			.into()
48	} else {
49		ui::icon(if build.status == Status::Done {
50			"check"
51		} else {
52			"x"
53		})
54		.tone(if build.status == Status::Done {
55			"success"
56		} else {
57			"error"
58		})
59		.into()
60	};
61	let mut timer = ui::elapsed().age(0);
62	if let Some(took) = build.took {
63		timer = timer.stopped(took);
64	}
65	View::new().main([ui::card()
66		.key("build")
67		.head("Building demo")
68		.status(build.status.clone())
69		.child(
70			ui::row()
71				.key("head")
72				.gap("sm")
73				.children(nodes![activity.key("a"), timer.key("t")]),
74		)
75		.child(
76			ui::ansi(&build.log)
77				.key("log")
78				.follow(true)
79				.max(Bound::h(Extent::Lines(8.0))),
80		)
81		.child(ui::progress().key("bar").value(fraction).label(format!(
82			"{}/{}",
83			build.done,
84			STEPS.len()
85		)))])
86}
examples/chat.rs (line 77)
62	fn view(&self) -> View<Msg> {
63		let messages = self.transcript.iter().enumerate().map(|(i, (who, text))| {
64			let node = ui::md(text.clone()).key(i);
65			if *who == "you" {
66				ui::card().key(i).tone("user").child(node.key("t"))
67			} else {
68				ui::card().key(i).variant("bare").child(node.key("t"))
69			}
70		});
71		let cursor: usize = self
72			.draft
73			.chars()
74			.take(self.cursor)
75			.map(char::len_utf16)
76			.sum();
77		View::new().main(ui::col().children(messages)).dock(nodes![
78			ui::editor()
79				.key("ed")
80				.text(self.draft.clone())
81				.cursor(cursor)
82				.placeholder("Message (Enter sends, Escape quits)")
83				.sendable(true)
84				.on_send(|text| Msg::Send(text.to_owned()))
85				.on_focus(Msg::Focus),
86			ui::status()
87				.key("bar")
88				.child(ui::seg("chat").icon("message"))
89				.child(
90					ui::seg(format!("{} messages", self.transcript.len()))
91						.side(Side::Right)
92						.tone(if self.transcript.is_empty() {
93							Tone::Muted
94						} else {
95							Tone::Success
96						}),
97				),
98		])
99	}
Source

pub fn main(self, region: impl Into<Node<M>>) -> Self

Sets main, the flowing document: a root node, or a list of children wrapped in a col.

Examples found in repository?
examples/dashboard.rs (line 676)
667	fn view(&self, plain: bool) -> View<Msg> {
668		let main = nodes![self.head(), self.stats().key("stats"), self.nav(), self.body(plain)];
669		let mut dock: Vec<Node<Msg>> = Vec::new();
670		if let Some((page, id)) = self.confirming
671			&& let Some(risk) = self.risk(page, id)
672		{
673			dock.push(confirm(&risk).into());
674		}
675		dock.push(self.legend().into());
676		View::new().main(main).dock(dock)
677	}
More examples
Hide additional examples
examples/ask.rs (lines 30-42)
28fn view() -> View<()> {
29	let sizes = SIZES.iter().map(|(value, label)| choice(value, label));
30	View::new().main([html::form().key("ask").child(
31		ui::card()
32			.key("card")
33			.head("Which size?")
34			.max(Bound::w(Extent::Ch(48.0)))
35			.child(ui::row().key("sizes").gap("lg").children(sizes))
36			.child(
37				ui::button("Create")
38					.key("go")
39					.variant("primary")
40					.actions(Actions::new().click("submit")),
41			),
42	)])
43}
examples/table.rs (lines 55-58)
43fn view(entries: &[Entry]) -> View {
44	let rows = entries.iter().map(|e| {
45		let (name, icon) = if e.dir {
46			(format!("{}/", e.name), "folder")
47		} else {
48			(e.name.clone(), "file")
49		};
50		let size = if e.dir { "-".to_owned() } else { human(e.size) };
51		TableRow::new(e.name.clone())
52			.cell("name", TextCell::new(name).icon(icon))
53			.cell("size", size)
54	});
55	View::new().main([ui::table()
56		.col(Column::new("name", "Name").grow(1.0))
57		.col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58		.rows(rows.collect::<Vec<_>>())])
59}
examples/progress.rs (lines 65-85)
40fn view(build: &Build) -> View {
41	let fraction = build.done as f64 / STEPS.len() as f64;
42	let running = build.took.is_none();
43	let activity: ui::Node = if running {
44		ui::spinner()
45			.style("dots")
46			.label(STEPS[build.done.min(STEPS.len() - 1)])
47			.into()
48	} else {
49		ui::icon(if build.status == Status::Done {
50			"check"
51		} else {
52			"x"
53		})
54		.tone(if build.status == Status::Done {
55			"success"
56		} else {
57			"error"
58		})
59		.into()
60	};
61	let mut timer = ui::elapsed().age(0);
62	if let Some(took) = build.took {
63		timer = timer.stopped(took);
64	}
65	View::new().main([ui::card()
66		.key("build")
67		.head("Building demo")
68		.status(build.status.clone())
69		.child(
70			ui::row()
71				.key("head")
72				.gap("sm")
73				.children(nodes![activity.key("a"), timer.key("t")]),
74		)
75		.child(
76			ui::ansi(&build.log)
77				.key("log")
78				.follow(true)
79				.max(Bound::h(Extent::Lines(8.0))),
80		)
81		.child(ui::progress().key("bar").value(fraction).label(format!(
82			"{}/{}",
83			build.done,
84			STEPS.len()
85		)))])
86}
examples/chat.rs (line 77)
62	fn view(&self) -> View<Msg> {
63		let messages = self.transcript.iter().enumerate().map(|(i, (who, text))| {
64			let node = ui::md(text.clone()).key(i);
65			if *who == "you" {
66				ui::card().key(i).tone("user").child(node.key("t"))
67			} else {
68				ui::card().key(i).variant("bare").child(node.key("t"))
69			}
70		});
71		let cursor: usize = self
72			.draft
73			.chars()
74			.take(self.cursor)
75			.map(char::len_utf16)
76			.sum();
77		View::new().main(ui::col().children(messages)).dock(nodes![
78			ui::editor()
79				.key("ed")
80				.text(self.draft.clone())
81				.cursor(cursor)
82				.placeholder("Message (Enter sends, Escape quits)")
83				.sendable(true)
84				.on_send(|text| Msg::Send(text.to_owned()))
85				.on_focus(Msg::Focus),
86			ui::status()
87				.key("bar")
88				.child(ui::seg("chat").icon("message"))
89				.child(
90					ui::seg(format!("{} messages", self.transcript.len()))
91						.side(Side::Right)
92						.tone(if self.transcript.is_empty() {
93							Tone::Muted
94						} else {
95							Tone::Success
96						}),
97				),
98		])
99	}
Source

pub fn dock(self, region: impl Into<Node<M>>) -> Self

Sets dock, sticky at the pane’s bottom: a root node, or a list.

Examples found in repository?
examples/dashboard.rs (line 676)
667	fn view(&self, plain: bool) -> View<Msg> {
668		let main = nodes![self.head(), self.stats().key("stats"), self.nav(), self.body(plain)];
669		let mut dock: Vec<Node<Msg>> = Vec::new();
670		if let Some((page, id)) = self.confirming
671			&& let Some(risk) = self.risk(page, id)
672		{
673			dock.push(confirm(&risk).into());
674		}
675		dock.push(self.legend().into());
676		View::new().main(main).dock(dock)
677	}
More examples
Hide additional examples
examples/chat.rs (lines 77-98)
62	fn view(&self) -> View<Msg> {
63		let messages = self.transcript.iter().enumerate().map(|(i, (who, text))| {
64			let node = ui::md(text.clone()).key(i);
65			if *who == "you" {
66				ui::card().key(i).tone("user").child(node.key("t"))
67			} else {
68				ui::card().key(i).variant("bare").child(node.key("t"))
69			}
70		});
71		let cursor: usize = self
72			.draft
73			.chars()
74			.take(self.cursor)
75			.map(char::len_utf16)
76			.sum();
77		View::new().main(ui::col().children(messages)).dock(nodes![
78			ui::editor()
79				.key("ed")
80				.text(self.draft.clone())
81				.cursor(cursor)
82				.placeholder("Message (Enter sends, Escape quits)")
83				.sendable(true)
84				.on_send(|text| Msg::Send(text.to_owned()))
85				.on_focus(Msg::Focus),
86			ui::status()
87				.key("bar")
88				.child(ui::seg("chat").icon("message"))
89				.child(
90					ui::seg(format!("{} messages", self.transcript.len()))
91						.side(Side::Right)
92						.tone(if self.transcript.is_empty() {
93							Tone::Muted
94						} else {
95							Tone::Success
96						}),
97				),
98		])
99	}
Source

pub fn layer(self, region: impl Into<Node<M>>) -> Self

Sets layer, the overlays: a root node, or a list.

Source

pub const fn regions(&self) -> [Option<&Node<M>>; 3]

The regions in order main, dock, layer.

Source

pub fn from_json(value: &Value) -> Result<Self, Error>

Builds a view from its wire form {main?, dock?, layer?} (null is the empty view; a region given as a list is wrapped in a col).

§Errors

Error::InvalidView for an unknown region or a malformed node.

Trait Implementations§

Source§

impl<M> Clone for View<M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<M> Debug for View<M>

Source§

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

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

impl<M> Default for View<M>

Source§

fn default() -> Self

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

impl<M> From<Agent<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Agent<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Ansi<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Ansi<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Attachment<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Attachment<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Avatar<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Avatar<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Avatars<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Avatars<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Badge<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Badge<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Breadcrumb<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Breadcrumb<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Button<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Button<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Buttons<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Buttons<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Calendar<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Calendar<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Card<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Card<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Carousel<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Carousel<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Chart<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Chart<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Checklist<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Checklist<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Code<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Code<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Col<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Col<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Date<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Date<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Diff<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Diff<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Editor<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Editor<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Effort<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Effort<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<El<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: El<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Elapsed<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Elapsed<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Empty<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Empty<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Field<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Field<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<IconNode<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: IconNode<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Image<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Image<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Input<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Input<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Item<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Item<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Json<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Json<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Kbd<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Kbd<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Kv<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Kv<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<List<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: List<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Math<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Math<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Md<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Md<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Media<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Media<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Menu<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Menu<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Menubar<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Menubar<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Message<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Message<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Meter<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Meter<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Nav<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Nav<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Node<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(node: Node<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Otp<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Otp<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Overlay<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Overlay<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Pager<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Pager<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Picker<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Picker<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Prefs<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Prefs<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Progress<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Progress<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Questions<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Questions<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Rate<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Rate<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Row<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Row<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Rows<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Rows<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Rule<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Rule<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Scroll<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Scroll<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Section<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Section<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Seg<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Seg<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Select<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Select<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Shimmer<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Shimmer<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Skeleton<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Skeleton<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Slider<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Slider<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Spacer<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Spacer<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Spinner<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Spinner<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Split<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Split<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Stacktrace<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Stacktrace<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Stats<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Stats<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<StatusBar<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: StatusBar<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Suggestions<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Suggestions<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Switch<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Switch<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Table<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Table<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Tabs<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Tabs<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<TextNode<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: TextNode<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Toast<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Toast<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Tool<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Tool<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Trace<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Trace<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Tree<M>> for View<M>

A bare node is main’s one child.

Source§

fn from(n: Tree<M>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Vec<Node<M>>> for View<M>

A list of nodes is main’s children.

Source§

fn from(children: Vec<Node<M>>) -> Self

Converts to this type from the input type.
Source§

impl<M, C: Into<Node<M>>, const N: usize> From<[C; N]> for View<M>

An array of nodes is main’s children.

Source§

fn from(children: [C; N]) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<M = ()> !RefUnwindSafe for View<M>

§

impl<M = ()> !UnwindSafe for View<M>

§

impl<M> Freeze for View<M>
where Option<Node<M>>: Freeze,

§

impl<M> Send for View<M>
where Option<Node<M>>: Send,

§

impl<M> Sync for View<M>
where Option<Node<M>>: Sync,

§

impl<M> Unpin for View<M>
where Option<Node<M>>: Unpin,

§

impl<M> UnsafeUnpin for View<M>
where Option<Node<M>>: UnsafeUnpin,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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