pub struct Server { /* private fields */ }Implementations§
Source§impl Server
impl Server
Sourcepub fn bind<A, F>(addr: A, app: F) -> Result<Server>
pub fn bind<A, F>(addr: A, app: F) -> Result<Server>
Listen on addr ("127.0.0.1:0" picks a free port) with a fresh
random token, to serve the apps app makes.
In a session’s own process (Isolation::Processes, the default),
this is where the session runs: the process this program started
for a browser tab reaches this same call, runs the app for that tab,
and exits here, without listening.
Examples found in repository?
More examples
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Sourcepub fn bind_command<A>(addr: A, command: impl Into<Command>) -> Result<Server>where
A: ToSocketAddrs,
pub fn bind_command<A>(addr: A, command: impl Into<Command>) -> Result<Server>where
A: ToSocketAddrs,
Listen on addr with a fresh random token, to run command on a
pseudo-terminal of its own for each tab (through LocalPty). The
page’s title is the program’s name unless set.
Sourcepub fn bind_host<A, F>(addr: A, host: F) -> Result<Server>
pub fn bind_host<A, F>(addr: A, host: F) -> Result<Server>
Listen on addr with a fresh random token, to run a program on the
PtyHost host makes for each tab: an SSH session, a container’s
exec stream, or a test host. It is made, started and dropped on the
session’s own thread. max_buffered bounds
only what the session holds: a host that reads ahead buffers on its
own terms.
Sourcepub fn isolation(self, isolation: Isolation) -> Server
pub fn isolation(self, isolation: Isolation) -> Server
Where an app’s sessions run: each in a process of its own
(Isolation::Processes, the default), or each on a thread of the
server (Isolation::Threads). A program’s sessions (a command, a
host) are processes already, and this does not change them.
Sourcepub fn session_command<P, I, S>(self, program: P, args: I) -> Server
pub fn session_command<P, I, S>(self, program: P, args: I) -> Server
Start each session’s process as program with args, rather than
as this program with the arguments it was given. It must reach the
same serve or Server::bind call: an interpreter running the same
script, say (Python’s rs_rich.tui.serve passes its own).
Sourcepub fn session_memory(self, bytes: u64) -> Server
pub fn session_memory(self, bytes: u64) -> Server
Cap each session’s process at bytes of memory (its address
space): an allocation past it fails, and the process ends, alone.
On Linux it holds from the moment the process starts; on other Unix
systems from when it reaches serve; macOS has no such limit, and
elsewhere (Windows) it is not applied.
Examples found in repository?
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}Sourcepub fn session_cpu(self, time: Duration) -> Server
pub fn session_cpu(self, time: Duration) -> Server
Cap each session’s process at time of CPU (whole seconds, at least
one): past it the process is killed, alone. A session that waits for
input uses none. On Linux it holds from the moment the process
starts; on other Unix systems from when it reaches serve;
elsewhere (Windows) it is not applied.
Examples found in repository?
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}Sourcepub fn max_sessions(self, n: usize) -> Server
pub fn max_sessions(self, n: usize) -> Server
Run at most n sessions at once (8 by default); a browser that
opens one more is refused until one ends.
Sourcepub fn max_buffered(self, bytes: usize) -> Server
pub fn max_buffered(self, bytes: usize) -> Server
For a program: hold at most about bytes of its output for a page
that has not shown it yet (1 MiB by default). Half is output sent
and not yet acknowledged by the page, half is output read from the
program and not yet sent; past that, the program’s writes wait until
the page catches up, as on a slow terminal, so nothing is dropped
and memory stays bounded however fast it writes, at any size (a
LocalPty with backpressure never drops output, even past its
own 16 MiB limit without it). Apps send whole frames and are not
affected.
Sourcepub fn compress(self, from: Option<usize>) -> Server
pub fn compress(self, from: Option<usize>) -> Server
Compress frames of from bytes or more with deflate, for pages
that can undo it (they have DecompressionStream, and ask with
z=1): an app’s frames, the DOM renderer’s messages and a
program’s output. Off (None) by default. Worth it over a slow
link: measured on a few scenes, frames shrink to 5 to 30% of their
size for 15 to 60 µs each (level 1). On a local machine it only
adds work. 1024 is a fair threshold.
Sourcepub fn renderer(self, renderer: Renderer) -> Server
pub fn renderer(self, renderer: Renderer) -> Server
How an app’s page draws it: Renderer::Xterm (the default) or
Renderer::Dom. A page’s address can ask for either with
&renderer=xterm or &renderer=dom. A program is always drawn by
xterm.js.
Sourcepub fn token(self, token: impl Into<String>) -> Server
pub fn token(self, token: impl Into<String>) -> Server
Use token instead of a random one, for an address that stays the
same between runs. Keep it as secret, and as long: anyone with it
can use the app.
§Panics
When token is empty or has characters other than ASCII letters,
digits, -, _, . and ~ (it goes in a URL as it is).
Examples found in repository?
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}More examples
65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Sourcepub fn allow_host(self, host: impl AsRef<str>) -> Server
pub fn allow_host(self, host: impl AsRef<str>) -> Server
Also answer to host (say "box.lan", or "box.lan:9000"): a name
this machine is reached by that the server does not know itself. The
server’s port is added unless host names one. The Host of a
WebSocket upgrade must be one the server answers to: its bound
address (with localhost for a loopback one), or, bound to all
interfaces, the loopback addresses, localhost, this machine’s own
name and the address the connection arrived on; plus these. That is
what stops a page whose name was pointed here (DNS rebinding). The
token is still required.
Sourcepub fn allow_origin(self, origin: impl Into<String>) -> Server
pub fn allow_origin(self, origin: impl Into<String>) -> Server
Also accept WebSocket upgrades from pages served at origin (say
"https://term.example.com"): the address a reverse proxy serves
this server’s page from. The token is still required.
Sourcepub fn title(self, title: impl Into<String>) -> Server
pub fn title(self, title: impl Into<String>) -> Server
The page’s title (intuiTUIve for an app, the program’s name for a
command, by default).
Examples found in repository?
More examples
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The address the server listens on.
Examples found in repository?
65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Sourcepub fn access_token(&self) -> &str
pub fn access_token(&self) -> &str
The token browsers must give.
Sourcepub fn run(self) -> Result<()>
pub fn run(self) -> Result<()>
Print the URL (and a warning when the address is not loopback), then serve until the process ends.
Examples found in repository?
More examples
42fn main() -> std::io::Result<()> {
43 let mut args = std::env::args().skip(1);
44 let mut addr = "127.0.0.1:8080".to_string();
45 let mut memory = 256u64 << 20;
46 let mut cpu = 10u64;
47 let mut token = None;
48 let mut startup = None;
49 while let Some(arg) = args.next() {
50 let mut value = || args.next().expect("a value after the option");
51 match arg.as_str() {
52 "--memory" => memory = value().parse().expect("bytes"),
53 "--cpu" => cpu = value().parse().expect("seconds"),
54 "--token" => token = Some(value()),
55 "--startup-memory" => startup = Some(value().parse::<usize>().expect("bytes")),
56 _ => addr = arg,
57 }
58 }
59 // Startup work in each session's process, before it reaches `bind`.
60 if let (Some(bytes), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
61 std::hint::black_box(vec![1u8; bytes]);
62 }
63 let mut server = rich_web::Server::bind(addr.as_str(), app)?
64 .title("isolated sessions")
65 .session_memory(memory)
66 .session_cpu(Duration::from_secs(cpu));
67 if let Some(token) = token {
68 server = server.token(token);
69 }
70 server.run()
71}65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Sourcepub fn run_until(self, until: impl FnOnce()) -> Result<()>
pub fn run_until(self, until: impl FnOnce()) -> Result<()>
Print the URL as run does, then serve until until
returns, and stop as Handle::stop does: every session ends, and
this returns once their programs have. until runs on this thread:
a wait for a signal, say, as rich serve waits for Ctrl+C, so that
no program outlives the server.
Sourcepub fn spawn(self) -> Result<Handle>
pub fn spawn(self) -> Result<Handle>
Serve on a thread of its own, printing nothing, until the
Handle is stopped or dropped.
Examples found in repository?
65fn main() -> std::io::Result<()> {
66 let mut args = std::env::args().skip(1);
67 let mut addr = "127.0.0.1:8080".to_string();
68 let mut token = None;
69 let mut startup = None;
70 let mut stdin_stop = false;
71 let mut nested = false;
72 while let Some(arg) = args.next() {
73 let mut value = || args.next().expect("a value after the option");
74 match arg.as_str() {
75 "--token" => token = Some(value()),
76 "--startup-sleep" => startup = Some(value().parse::<u64>().expect("ms")),
77 "--stdin-stop" => stdin_stop = true,
78 "--nested" => nested = true,
79 _ => addr = arg,
80 }
81 }
82 if nested {
83 // An unrelated program that serves an app: it should get the
84 // address it asked for.
85 let server = rich_web::Server::bind(addr.as_str(), app)?;
86 println!("BOUND {}", server.local_addr());
87 return Ok(());
88 }
89 if let (Some(ms), true) = (startup, std::env::var_os(rich_web::SESSION_ENV).is_some()) {
90 std::thread::sleep(Duration::from_millis(ms));
91 }
92 let mut server = rich_web::Server::bind(addr.as_str(), app)?.title("session probe");
93 if let Some(token) = token {
94 server = server.token(token);
95 }
96 if stdin_stop {
97 let handle = server.spawn()?;
98 println!("Serving session probe at {}", handle.url());
99 let mut line = String::new();
100 std::io::stdin().lock().read_line(&mut line)?;
101 let started = Instant::now();
102 handle.stop();
103 println!("STOPPED {}", started.elapsed().as_millis());
104 return Ok(());
105 }
106 server.run()
107}Auto Trait Implementations§
impl !Freeze for Server
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.