Skip to main content

Series

Struct Series 

Source
pub struct Series { /* private fields */ }
Expand description

Plot series with data storage and styling.

Series own their data and provide append-only methods for streaming workloads. All axes and transforms are handled at the plot level.

Use Series::share when multiple plots should observe the same live append-only stream. By contrast, Clone creates an independent copy.

Implementations§

Source§

impl Series

Source

pub fn line(name: impl Into<String>) -> Self

Create a line series with indexed data.

Indexed data uses implicit X values (0, 1, 2, …).

Examples found in repository?
examples/advanced.rs (line 42)
34fn build_views(
35    cx: &mut gpui::App,
36) -> (
37    gpui::Entity<GpuiPlotView>,
38    gpui::Entity<GpuiPlotView>,
39    Series,
40    Series,
41) {
42    let mut stream_a = Series::line("stream-A").with_kind(SeriesKind::Line(LineStyle {
43        color: Color::new(0.2, 0.82, 0.95, 1.0),
44        width: 2.0,
45    }));
46    let mut stream_b = Series::line("stream-B").with_kind(SeriesKind::Line(LineStyle {
47        color: Color::new(0.95, 0.64, 0.28, 1.0),
48        width: 2.0,
49    }));
50
51    for i in 0..1_000 {
52        let phase = i as f64 * 0.02;
53        let _ = stream_a.push_y((phase * 0.9).sin() + 0.2 * (phase * 0.13).cos());
54        let _ = stream_b.push_y((phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin());
55    }
56
57    let events = Series::from_iter_points(
58        "events(scatter)",
59        (0..200).map(|i| {
60            let x = i as f64 * 80.0 + 40.0;
61            let y = (x * 0.02).sin() * 0.9;
62            gpui_liveplot::Point::new(x, y)
63        }),
64        SeriesKind::Scatter(MarkerStyle {
65            color: Color::new(0.95, 0.25, 0.55, 1.0),
66            size: 5.0,
67            shape: MarkerShape::Circle,
68        }),
69    );
70
71    let baseline = Series::from_explicit_callback(
72        "baseline(callback)",
73        |x| (x * 0.015).sin() * 0.4,
74        Range::new(0.0, 25_000.0),
75        5_000,
76        SeriesKind::Line(LineStyle {
77            color: Color::new(0.45, 0.45, 0.5, 0.8),
78            width: 1.0,
79        }),
80    );
81
82    let mut top_plot = Plot::builder()
83        .theme(Theme::dark())
84        .x_axis(AxisConfig::builder().title("Sample").build())
85        .y_axis(AxisConfig::builder().title("Top: stream + events").build())
86        .view(View::FollowLastN { points: 2_000 })
87        .build();
88    top_plot.add_series(&stream_a);
89    top_plot.add_series(&events);
90
91    let mut bottom_plot = Plot::builder()
92        .theme(Theme::dark())
93        .x_axis(AxisConfig::builder().title("Sample").build())
94        .y_axis(
95            AxisConfig::builder()
96                .title("Bottom: stream + baseline")
97                .build(),
98        )
99        .view(View::FollowLastNXY { points: 2_000 })
100        .build();
101    bottom_plot.add_series(&stream_b);
102    bottom_plot.add_series(&baseline);
103
104    let config = PlotViewConfig {
105        show_legend: true,
106        show_hover: true,
107        ..Default::default()
108    };
109
110    let link_group = PlotLinkGroup::new();
111    let options = PlotLinkOptions {
112        link_x: true,
113        link_y: false,
114        link_cursor: true,
115        link_brush: true,
116        link_reset: true,
117    };
118
119    let top = cx.new(|_| {
120        GpuiPlotView::with_config(top_plot, config.clone())
121            .with_link_group(link_group.clone(), options)
122    });
123    let bottom = cx.new(|_| {
124        GpuiPlotView::with_config(bottom_plot, config).with_link_group(link_group, options)
125    });
126
127    (top, bottom, stream_a, stream_b)
128}
Source

pub fn scatter(name: impl Into<String>) -> Self

Create a scatter series with indexed data.

Indexed data uses implicit X values (0, 1, 2, …).

Source

pub fn from_iter_y<I, T>( name: impl Into<String>, iter: I, kind: SeriesKind, ) -> Self
where I: IntoIterator<Item = T>, T: Into<f64>,

Build a series from an iterator of Y values.

X values are assigned as implicit indices.

Examples found in repository?
examples/basic.rs (lines 19-29)
7fn main() {
8    Application::new().run(|cx| {
9        let options = WindowOptions {
10            window_bounds: Some(WindowBounds::Windowed(Bounds::centered(
11                None,
12                size(px(720.0), px(480.0)),
13                cx,
14            ))),
15            ..Default::default()
16        };
17
18        cx.open_window(options, |_window, cx| {
19            let series = Series::from_iter_y(
20                "signal",
21                (0..400).map(|i| {
22                    let x = i as f64 * 0.03;
23                    x.sin()
24                }),
25                SeriesKind::Line(LineStyle {
26                    color: Color::new(0.2, 0.75, 0.95, 1.0),
27                    width: 2.0,
28                }),
29            );
30
31            let mut plot = Plot::builder()
32                .theme(Theme::dark())
33                .x_axis(AxisConfig::builder().title("Sample").build())
34                .y_axis(AxisConfig::builder().title("Amplitude").build())
35                .build();
36            plot.add_series(&series);
37
38            let config = PlotViewConfig {
39                show_legend: true,
40                show_hover: true,
41                ..Default::default()
42            };
43
44            let view = GpuiPlotView::with_config(plot, config);
45            cx.new(|_| view)
46        })
47        .unwrap();
48    });
49}
Source

pub fn from_iter_points<I>( name: impl Into<String>, iter: I, kind: SeriesKind, ) -> Self
where I: IntoIterator<Item = Point>,

Build a series from an iterator of points.

X values are taken from each Point.

Examples found in repository?
examples/advanced.rs (lines 57-69)
34fn build_views(
35    cx: &mut gpui::App,
36) -> (
37    gpui::Entity<GpuiPlotView>,
38    gpui::Entity<GpuiPlotView>,
39    Series,
40    Series,
41) {
42    let mut stream_a = Series::line("stream-A").with_kind(SeriesKind::Line(LineStyle {
43        color: Color::new(0.2, 0.82, 0.95, 1.0),
44        width: 2.0,
45    }));
46    let mut stream_b = Series::line("stream-B").with_kind(SeriesKind::Line(LineStyle {
47        color: Color::new(0.95, 0.64, 0.28, 1.0),
48        width: 2.0,
49    }));
50
51    for i in 0..1_000 {
52        let phase = i as f64 * 0.02;
53        let _ = stream_a.push_y((phase * 0.9).sin() + 0.2 * (phase * 0.13).cos());
54        let _ = stream_b.push_y((phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin());
55    }
56
57    let events = Series::from_iter_points(
58        "events(scatter)",
59        (0..200).map(|i| {
60            let x = i as f64 * 80.0 + 40.0;
61            let y = (x * 0.02).sin() * 0.9;
62            gpui_liveplot::Point::new(x, y)
63        }),
64        SeriesKind::Scatter(MarkerStyle {
65            color: Color::new(0.95, 0.25, 0.55, 1.0),
66            size: 5.0,
67            shape: MarkerShape::Circle,
68        }),
69    );
70
71    let baseline = Series::from_explicit_callback(
72        "baseline(callback)",
73        |x| (x * 0.015).sin() * 0.4,
74        Range::new(0.0, 25_000.0),
75        5_000,
76        SeriesKind::Line(LineStyle {
77            color: Color::new(0.45, 0.45, 0.5, 0.8),
78            width: 1.0,
79        }),
80    );
81
82    let mut top_plot = Plot::builder()
83        .theme(Theme::dark())
84        .x_axis(AxisConfig::builder().title("Sample").build())
85        .y_axis(AxisConfig::builder().title("Top: stream + events").build())
86        .view(View::FollowLastN { points: 2_000 })
87        .build();
88    top_plot.add_series(&stream_a);
89    top_plot.add_series(&events);
90
91    let mut bottom_plot = Plot::builder()
92        .theme(Theme::dark())
93        .x_axis(AxisConfig::builder().title("Sample").build())
94        .y_axis(
95            AxisConfig::builder()
96                .title("Bottom: stream + baseline")
97                .build(),
98        )
99        .view(View::FollowLastNXY { points: 2_000 })
100        .build();
101    bottom_plot.add_series(&stream_b);
102    bottom_plot.add_series(&baseline);
103
104    let config = PlotViewConfig {
105        show_legend: true,
106        show_hover: true,
107        ..Default::default()
108    };
109
110    let link_group = PlotLinkGroup::new();
111    let options = PlotLinkOptions {
112        link_x: true,
113        link_y: false,
114        link_cursor: true,
115        link_brush: true,
116        link_reset: true,
117    };
118
119    let top = cx.new(|_| {
120        GpuiPlotView::with_config(top_plot, config.clone())
121            .with_link_group(link_group.clone(), options)
122    });
123    let bottom = cx.new(|_| {
124        GpuiPlotView::with_config(bottom_plot, config).with_link_group(link_group, options)
125    });
126
127    (top, bottom, stream_a, stream_b)
128}
Source

pub fn from_explicit_callback( name: impl Into<String>, function: impl Fn(f64) -> f64, x_range: Range, points: usize, kind: SeriesKind, ) -> Self

Build a series by sampling a callback function.

The callback is sampled uniformly across x_range.

Examples found in repository?
examples/advanced.rs (lines 71-80)
34fn build_views(
35    cx: &mut gpui::App,
36) -> (
37    gpui::Entity<GpuiPlotView>,
38    gpui::Entity<GpuiPlotView>,
39    Series,
40    Series,
41) {
42    let mut stream_a = Series::line("stream-A").with_kind(SeriesKind::Line(LineStyle {
43        color: Color::new(0.2, 0.82, 0.95, 1.0),
44        width: 2.0,
45    }));
46    let mut stream_b = Series::line("stream-B").with_kind(SeriesKind::Line(LineStyle {
47        color: Color::new(0.95, 0.64, 0.28, 1.0),
48        width: 2.0,
49    }));
50
51    for i in 0..1_000 {
52        let phase = i as f64 * 0.02;
53        let _ = stream_a.push_y((phase * 0.9).sin() + 0.2 * (phase * 0.13).cos());
54        let _ = stream_b.push_y((phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin());
55    }
56
57    let events = Series::from_iter_points(
58        "events(scatter)",
59        (0..200).map(|i| {
60            let x = i as f64 * 80.0 + 40.0;
61            let y = (x * 0.02).sin() * 0.9;
62            gpui_liveplot::Point::new(x, y)
63        }),
64        SeriesKind::Scatter(MarkerStyle {
65            color: Color::new(0.95, 0.25, 0.55, 1.0),
66            size: 5.0,
67            shape: MarkerShape::Circle,
68        }),
69    );
70
71    let baseline = Series::from_explicit_callback(
72        "baseline(callback)",
73        |x| (x * 0.015).sin() * 0.4,
74        Range::new(0.0, 25_000.0),
75        5_000,
76        SeriesKind::Line(LineStyle {
77            color: Color::new(0.45, 0.45, 0.5, 0.8),
78            width: 1.0,
79        }),
80    );
81
82    let mut top_plot = Plot::builder()
83        .theme(Theme::dark())
84        .x_axis(AxisConfig::builder().title("Sample").build())
85        .y_axis(AxisConfig::builder().title("Top: stream + events").build())
86        .view(View::FollowLastN { points: 2_000 })
87        .build();
88    top_plot.add_series(&stream_a);
89    top_plot.add_series(&events);
90
91    let mut bottom_plot = Plot::builder()
92        .theme(Theme::dark())
93        .x_axis(AxisConfig::builder().title("Sample").build())
94        .y_axis(
95            AxisConfig::builder()
96                .title("Bottom: stream + baseline")
97                .build(),
98        )
99        .view(View::FollowLastNXY { points: 2_000 })
100        .build();
101    bottom_plot.add_series(&stream_b);
102    bottom_plot.add_series(&baseline);
103
104    let config = PlotViewConfig {
105        show_legend: true,
106        show_hover: true,
107        ..Default::default()
108    };
109
110    let link_group = PlotLinkGroup::new();
111    let options = PlotLinkOptions {
112        link_x: true,
113        link_y: false,
114        link_cursor: true,
115        link_brush: true,
116        link_reset: true,
117    };
118
119    let top = cx.new(|_| {
120        GpuiPlotView::with_config(top_plot, config.clone())
121            .with_link_group(link_group.clone(), options)
122    });
123    let bottom = cx.new(|_| {
124        GpuiPlotView::with_config(bottom_plot, config).with_link_group(link_group, options)
125    });
126
127    (top, bottom, stream_a, stream_b)
128}
Source

pub fn id(&self) -> SeriesId

Access the series identifier.

Source

pub fn name(&self) -> &str

Access the series name.

Source

pub fn kind(&self) -> &SeriesKind

Access the series kind.

Source

pub fn with_kind(self, kind: SeriesKind) -> Self

Replace the series kind.

Examples found in repository?
examples/advanced.rs (lines 42-45)
34fn build_views(
35    cx: &mut gpui::App,
36) -> (
37    gpui::Entity<GpuiPlotView>,
38    gpui::Entity<GpuiPlotView>,
39    Series,
40    Series,
41) {
42    let mut stream_a = Series::line("stream-A").with_kind(SeriesKind::Line(LineStyle {
43        color: Color::new(0.2, 0.82, 0.95, 1.0),
44        width: 2.0,
45    }));
46    let mut stream_b = Series::line("stream-B").with_kind(SeriesKind::Line(LineStyle {
47        color: Color::new(0.95, 0.64, 0.28, 1.0),
48        width: 2.0,
49    }));
50
51    for i in 0..1_000 {
52        let phase = i as f64 * 0.02;
53        let _ = stream_a.push_y((phase * 0.9).sin() + 0.2 * (phase * 0.13).cos());
54        let _ = stream_b.push_y((phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin());
55    }
56
57    let events = Series::from_iter_points(
58        "events(scatter)",
59        (0..200).map(|i| {
60            let x = i as f64 * 80.0 + 40.0;
61            let y = (x * 0.02).sin() * 0.9;
62            gpui_liveplot::Point::new(x, y)
63        }),
64        SeriesKind::Scatter(MarkerStyle {
65            color: Color::new(0.95, 0.25, 0.55, 1.0),
66            size: 5.0,
67            shape: MarkerShape::Circle,
68        }),
69    );
70
71    let baseline = Series::from_explicit_callback(
72        "baseline(callback)",
73        |x| (x * 0.015).sin() * 0.4,
74        Range::new(0.0, 25_000.0),
75        5_000,
76        SeriesKind::Line(LineStyle {
77            color: Color::new(0.45, 0.45, 0.5, 0.8),
78            width: 1.0,
79        }),
80    );
81
82    let mut top_plot = Plot::builder()
83        .theme(Theme::dark())
84        .x_axis(AxisConfig::builder().title("Sample").build())
85        .y_axis(AxisConfig::builder().title("Top: stream + events").build())
86        .view(View::FollowLastN { points: 2_000 })
87        .build();
88    top_plot.add_series(&stream_a);
89    top_plot.add_series(&events);
90
91    let mut bottom_plot = Plot::builder()
92        .theme(Theme::dark())
93        .x_axis(AxisConfig::builder().title("Sample").build())
94        .y_axis(
95            AxisConfig::builder()
96                .title("Bottom: stream + baseline")
97                .build(),
98        )
99        .view(View::FollowLastNXY { points: 2_000 })
100        .build();
101    bottom_plot.add_series(&stream_b);
102    bottom_plot.add_series(&baseline);
103
104    let config = PlotViewConfig {
105        show_legend: true,
106        show_hover: true,
107        ..Default::default()
108    };
109
110    let link_group = PlotLinkGroup::new();
111    let options = PlotLinkOptions {
112        link_x: true,
113        link_y: false,
114        link_cursor: true,
115        link_brush: true,
116        link_reset: true,
117    };
118
119    let top = cx.new(|_| {
120        GpuiPlotView::with_config(top_plot, config.clone())
121            .with_link_group(link_group.clone(), options)
122    });
123    let bottom = cx.new(|_| {
124        GpuiPlotView::with_config(bottom_plot, config).with_link_group(link_group, options)
125    });
126
127    (top, bottom, stream_a, stream_b)
128}
Source

pub fn share(&self) -> Self

Create another series handle that shares the same append-only data.

The returned series receives a new SeriesId, so it can coexist with the source series in the same plot. Data appends through either series are immediately visible to all shared handles.

Source

pub fn push_y(&mut self, y: f64) -> Result<usize, AppendError>

Append a Y value to an indexed series.

Examples found in repository?
examples/advanced.rs (line 53)
34fn build_views(
35    cx: &mut gpui::App,
36) -> (
37    gpui::Entity<GpuiPlotView>,
38    gpui::Entity<GpuiPlotView>,
39    Series,
40    Series,
41) {
42    let mut stream_a = Series::line("stream-A").with_kind(SeriesKind::Line(LineStyle {
43        color: Color::new(0.2, 0.82, 0.95, 1.0),
44        width: 2.0,
45    }));
46    let mut stream_b = Series::line("stream-B").with_kind(SeriesKind::Line(LineStyle {
47        color: Color::new(0.95, 0.64, 0.28, 1.0),
48        width: 2.0,
49    }));
50
51    for i in 0..1_000 {
52        let phase = i as f64 * 0.02;
53        let _ = stream_a.push_y((phase * 0.9).sin() + 0.2 * (phase * 0.13).cos());
54        let _ = stream_b.push_y((phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin());
55    }
56
57    let events = Series::from_iter_points(
58        "events(scatter)",
59        (0..200).map(|i| {
60            let x = i as f64 * 80.0 + 40.0;
61            let y = (x * 0.02).sin() * 0.9;
62            gpui_liveplot::Point::new(x, y)
63        }),
64        SeriesKind::Scatter(MarkerStyle {
65            color: Color::new(0.95, 0.25, 0.55, 1.0),
66            size: 5.0,
67            shape: MarkerShape::Circle,
68        }),
69    );
70
71    let baseline = Series::from_explicit_callback(
72        "baseline(callback)",
73        |x| (x * 0.015).sin() * 0.4,
74        Range::new(0.0, 25_000.0),
75        5_000,
76        SeriesKind::Line(LineStyle {
77            color: Color::new(0.45, 0.45, 0.5, 0.8),
78            width: 1.0,
79        }),
80    );
81
82    let mut top_plot = Plot::builder()
83        .theme(Theme::dark())
84        .x_axis(AxisConfig::builder().title("Sample").build())
85        .y_axis(AxisConfig::builder().title("Top: stream + events").build())
86        .view(View::FollowLastN { points: 2_000 })
87        .build();
88    top_plot.add_series(&stream_a);
89    top_plot.add_series(&events);
90
91    let mut bottom_plot = Plot::builder()
92        .theme(Theme::dark())
93        .x_axis(AxisConfig::builder().title("Sample").build())
94        .y_axis(
95            AxisConfig::builder()
96                .title("Bottom: stream + baseline")
97                .build(),
98        )
99        .view(View::FollowLastNXY { points: 2_000 })
100        .build();
101    bottom_plot.add_series(&stream_b);
102    bottom_plot.add_series(&baseline);
103
104    let config = PlotViewConfig {
105        show_legend: true,
106        show_hover: true,
107        ..Default::default()
108    };
109
110    let link_group = PlotLinkGroup::new();
111    let options = PlotLinkOptions {
112        link_x: true,
113        link_y: false,
114        link_cursor: true,
115        link_brush: true,
116        link_reset: true,
117    };
118
119    let top = cx.new(|_| {
120        GpuiPlotView::with_config(top_plot, config.clone())
121            .with_link_group(link_group.clone(), options)
122    });
123    let bottom = cx.new(|_| {
124        GpuiPlotView::with_config(bottom_plot, config).with_link_group(link_group, options)
125    });
126
127    (top, bottom, stream_a, stream_b)
128}
Source

pub fn extend_y<I, T>(&mut self, values: I) -> Result<usize, AppendError>
where I: IntoIterator<Item = T>, T: Into<f64>,

Append multiple Y values to an indexed series.

Returns the number of appended points.

Examples found in repository?
examples/advanced.rs (lines 145-149)
130fn spawn_updates(
131    window: &mut gpui::Window,
132    cx: &mut gpui::App,
133    top: gpui::Entity<GpuiPlotView>,
134    bottom: gpui::Entity<GpuiPlotView>,
135    mut stream_a: Series,
136    mut stream_b: Series,
137) {
138    window
139        .spawn(cx, move |cx: &mut AsyncWindowContext| {
140            let mut cx = cx.clone();
141            async move {
142                let mut phase = 0.0_f64;
143                loop {
144                    Timer::after(Duration::from_millis(16)).await;
145                    let _ = stream_a.extend_y((0..120).map(|_| {
146                        let y = (phase * 0.9).sin() + 0.2 * (phase * 0.13).cos();
147                        phase += 0.02;
148                        y
149                    }));
150                    let _ = stream_b.extend_y((0..120).map(|_| {
151                        let y = (phase * 0.45).cos() * 1.15 + 0.15 * (phase * 0.09).sin();
152                        phase += 0.02;
153                        y
154                    }));
155
156                    let _ = cx.update(|_, cx| {
157                        top.update(cx, |_view, view_cx| view_cx.notify());
158                        bottom.update(cx, |_view, view_cx| view_cx.notify());
159                    });
160                }
161            }
162        })
163        .detach();
164}
Source

pub fn push_point(&mut self, point: Point) -> Result<usize, AppendError>

Append a point to an explicit series.

Source

pub fn extend_points<I>(&mut self, points: I) -> Result<usize, AppendError>
where I: IntoIterator<Item = Point>,

Append multiple explicit points to a series.

Returns the number of appended points when X values stay monotonic. If any new point has a smaller X than the previous point, all points are still appended and AppendError::NonMonotonicX is returned.

Source

pub fn bounds(&self) -> Option<Viewport>

Access the series bounds.

Source

pub fn generation(&self) -> u64

Access the series generation.

This monotonically increasing value is used for render cache invalidation.

Source

pub fn is_visible(&self) -> bool

Check if the series is visible.

Source

pub fn set_visible(&mut self, visible: bool)

Toggle series visibility.

Trait Implementations§

Source§

impl Clone for Series

Source§

fn clone(&self) -> Self

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 Series

Source§

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

Formats the value using the given formatter. Read more

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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<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 = 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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