Struct druid::WindowDesc

source ·
pub struct WindowDesc<T> {
    pub id: WindowId,
    /* private fields */
}
Expand description

A description of a window to be instantiated.

This struct has builder methods to specify some window properties. Each of these methods usually corresponds to a platform API call when constructing the function. Except for title(), they have no default values and the APIS won’t be called if the method is not used.

Fields§

§id: WindowId

The WindowId that will be assigned to this window.

This can be used to track a window from when it is launched and when it actually connects.

Implementations§

source§

impl<T: Data> WindowDesc<T>

source

pub fn new<W>(root: W) -> WindowDesc<T>where W: Widget<T> + 'static,

Create a new WindowDesc, taking the root Widget for this window.

Examples found in repository?
examples/layout.rs (line 80)
79
80
81
82
83
84
85
86
pub fn main() {
    let window = WindowDesc::new(build_app()).title("Very flexible");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0)
        .expect("launch failed");
}
More examples
Hide additional examples
examples/either.rs (line 51)
50
51
52
53
54
55
56
pub fn main() {
    let main_window = WindowDesc::new(ui_builder()).title("Switcheroo");
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(AppState::default())
        .expect("launch failed");
}
examples/custom_widget.rs (line 157)
156
157
158
159
160
161
162
pub fn main() {
    let window = WindowDesc::new(CustomWidget {}).title(LocalizedString::new("Fancy Colors"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch("Druid + Piet".to_string())
        .expect("launch failed");
}
examples/split_demo.rs (line 83)
82
83
84
85
86
87
88
89
pub fn main() {
    let window = WindowDesc::new(build_app())
        .title(LocalizedString::new("split-demo-window-title").with_placeholder("Split Demo"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0u32)
        .expect("launch failed");
}
examples/scroll.rs (line 28)
27
28
29
30
31
32
33
34
pub fn main() {
    let window = WindowDesc::new(build_widget())
        .title(LocalizedString::new("scroll-demo-window-title").with_placeholder("Scroll demo"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0u32)
        .expect("launch failed");
}
examples/identity.rs (line 46)
45
46
47
48
49
50
51
52
53
54
55
pub fn main() {
    let window = WindowDesc::new(make_ui()).title("identity example");
    let data = OurData {
        counter_one: 0,
        counter_two: 0,
    };
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(data)
        .expect("launch failed");
}
source

pub fn title(self, title: impl Into<LabelText<T>>) -> Self

Set the title for this window. This is a LabelText; it can be either a String, a LocalizedString, or a closure that computes a string; it will be kept up to date as the application’s state changes.

If this method isn’t called, the default title will be LocalizedString::new("app-name").

Examples found in repository?
examples/layout.rs (line 80)
79
80
81
82
83
84
85
86
pub fn main() {
    let window = WindowDesc::new(build_app()).title("Very flexible");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0)
        .expect("launch failed");
}
More examples
Hide additional examples
examples/either.rs (line 51)
50
51
52
53
54
55
56
pub fn main() {
    let main_window = WindowDesc::new(ui_builder()).title("Switcheroo");
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(AppState::default())
        .expect("launch failed");
}
examples/custom_widget.rs (line 157)
156
157
158
159
160
161
162
pub fn main() {
    let window = WindowDesc::new(CustomWidget {}).title(LocalizedString::new("Fancy Colors"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch("Druid + Piet".to_string())
        .expect("launch failed");
}
examples/split_demo.rs (line 84)
82
83
84
85
86
87
88
89
pub fn main() {
    let window = WindowDesc::new(build_app())
        .title(LocalizedString::new("split-demo-window-title").with_placeholder("Split Demo"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0u32)
        .expect("launch failed");
}
examples/scroll.rs (line 29)
27
28
29
30
31
32
33
34
pub fn main() {
    let window = WindowDesc::new(build_widget())
        .title(LocalizedString::new("scroll-demo-window-title").with_placeholder("Scroll demo"));
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0u32)
        .expect("launch failed");
}
examples/identity.rs (line 46)
45
46
47
48
49
50
51
52
53
54
55
pub fn main() {
    let window = WindowDesc::new(make_ui()).title("identity example");
    let data = OurData {
        counter_one: 0,
        counter_two: 0,
    };
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(data)
        .expect("launch failed");
}
source

pub fn menu( self, menu: impl FnMut(Option<WindowId>, &T, &Env) -> Menu<T> + 'static ) -> Self

Set the menu for this window.

menu is a callback for creating the menu. Its first argument is the id of the window that will have the menu, or None if it’s creating the root application menu for an app with no menus (which can happen, for example, on macOS).

Examples found in repository?
examples/multiwin.rs (line 39)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
pub fn main() {
    let main_window = WindowDesc::new(ui_builder()).menu(make_menu).title(
        LocalizedString::new("multiwin-demo-window-title").with_placeholder("Many windows!"),
    );
    AppLauncher::with_window(main_window)
        .delegate(Delegate {
            windows: Vec::new(),
        })
        .log_to_console()
        .launch(State::default())
        .expect("launch failed");
}

fn ui_builder() -> impl Widget<State> {
    let text = LocalizedString::new("hello-counter")
        .with_arg("count", |data: &State, _env| data.menu_count.into());
    let label = Label::new(text);
    let inc_button =
        Button::<State>::new("Add menu item").on_click(|_ctx, data, _env| data.menu_count += 1);
    let dec_button = Button::<State>::new("Remove menu item")
        .on_click(|_ctx, data, _env| data.menu_count = data.menu_count.saturating_sub(1));
    let new_button = Button::<State>::new("New window").on_click(|ctx, _data, _env| {
        ctx.submit_command(sys_cmds::NEW_FILE.to(Global));
    });
    let quit_button = Button::<State>::new("Quit app").on_click(|_ctx, _data, _env| {
        Application::global().quit();
    });

    let mut col = Flex::column();
    col.add_flex_child(Align::centered(Padding::new(5.0, label)), 1.0);
    let mut row = Flex::row();
    row.add_child(Padding::new(5.0, inc_button));
    row.add_child(Padding::new(5.0, dec_button));
    col.add_flex_child(Align::centered(row), 1.0);
    let mut row = Flex::row();
    row.add_child(Padding::new(5.0, new_button));
    row.add_child(Padding::new(5.0, quit_button));
    col.add_flex_child(Align::centered(row), 1.0);
    let content = ControllerHost::new(col, ContextMenuController);
    Glow::new(content)
}

struct Glow<W> {
    inner: W,
}

impl<W> Glow<W> {
    pub fn new(inner: W) -> Glow<W> {
        Glow { inner }
    }
}

impl<W: Widget<State>> Widget<State> for Glow<W> {
    fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut State, env: &Env) {
        self.inner.event(ctx, event, data, env);
    }

    fn lifecycle(&mut self, ctx: &mut LifeCycleCtx, event: &LifeCycle, data: &State, env: &Env) {
        if let LifeCycle::HotChanged(_) = event {
            ctx.request_paint();
        }
        self.inner.lifecycle(ctx, event, data, env);
    }

    fn update(&mut self, ctx: &mut UpdateCtx, old_data: &State, data: &State, env: &Env) {
        if old_data.glow_hot != data.glow_hot {
            ctx.request_paint();
        }
        self.inner.update(ctx, old_data, data, env);
    }

    fn layout(
        &mut self,
        ctx: &mut LayoutCtx,
        bc: &BoxConstraints,
        data: &State,
        env: &Env,
    ) -> Size {
        self.inner.layout(ctx, bc, data, env)
    }

    fn paint(&mut self, ctx: &mut PaintCtx, data: &State, env: &Env) {
        if data.glow_hot && ctx.is_hot() {
            BackgroundBrush::Color(Color::rgb8(200, 55, 55)).paint(ctx, data, env);
        }
        self.inner.paint(ctx, data, env);
    }
}

struct ContextMenuController;
struct Delegate {
    windows: Vec<WindowId>,
}

impl<W: Widget<State>> Controller<State, W> for ContextMenuController {
    fn event(
        &mut self,
        child: &mut W,
        ctx: &mut EventCtx,
        event: &Event,
        data: &mut State,
        env: &Env,
    ) {
        match event {
            Event::MouseDown(ref mouse) if mouse.button.is_right() => {
                ctx.show_context_menu(make_context_menu(), mouse.pos);
            }
            _ => child.event(ctx, event, data, env),
        }
    }
}

impl AppDelegate<State> for Delegate {
    fn command(
        &mut self,
        ctx: &mut DelegateCtx,
        _target: Target,
        cmd: &Command,
        data: &mut State,
        _env: &Env,
    ) -> Handled {
        if cmd.is(sys_cmds::NEW_FILE) {
            let new_win = WindowDesc::new(ui_builder())
                .menu(make_menu)
                .window_size((data.selected as f64 * 100.0 + 300.0, 500.0));
            ctx.new_window(new_win);
            Handled::Yes
        } else {
            Handled::No
        }
    }
More examples
Hide additional examples
examples/textbox.rs (line 51)
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pub fn main() {
    // describe the main window
    let main_window = WindowDesc::new(build_root_widget())
        .title(WINDOW_TITLE)
        .menu(make_menu)
        .window_size((400.0, 600.0));

    // create the initial app state
    let initial_state = AppState {
        single: "".to_string().into(),
        multi: "".to_string().into(),
    };

    // start the application
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(initial_state)
        .expect("Failed to launch application");
}
examples/markdown_preview.rs (line 98)
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
pub fn main() {
    // describe the main window
    let main_window = WindowDesc::new(build_root_widget())
        .title(WINDOW_TITLE)
        .menu(make_menu)
        .window_size((700.0, 600.0));

    // create the initial app state
    let initial_state = AppState {
        raw: TEXT.to_owned(),
        rendered: rebuild_rendered_text(TEXT),
    };

    // start the application
    AppLauncher::with_window(main_window)
        .log_to_console()
        .delegate(Delegate)
        .launch(initial_state)
        .expect("Failed to launch application");
}
source

pub fn window_size_policy(self, size_policy: WindowSizePolicy) -> Self

Set the window size policy

source

pub fn window_size(self, size: impl Into<Size>) -> Self

Set the window’s initial drawing area size in display points.

You can pass in a tuple (width, height) or a Size, e.g. to create a window with a drawing area 1000dp wide and 500dp high:

window.window_size((1000.0, 500.0));

The actual window size in pixels will depend on the platform DPI settings.

This should be considered a request to the platform to set the size of the window. The platform might increase the size a tiny bit due to DPI.

Examples found in repository?
examples/transparency.rs (line 51)
48
49
50
51
52
53
54
55
56
57
58
59
60
pub fn main() {
    let window = WindowDesc::new(build_root_widget())
        .show_titlebar(false)
        .window_size((512., 512.))
        .transparent(true)
        .resizable(true)
        .title("Transparent background");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(HelloState { name: "".into() })
        .expect("launch failed");
}
More examples
Hide additional examples
examples/z_stack.rs (line 33)
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pub fn main() {
    // describe the main window
    let main_window = WindowDesc::new(build_root_widget())
        .title("Hello World!")
        .window_size((400.0, 400.0));

    // create the initial app state
    let initial_state: State = State { counter: 0 };

    // start the application. Here we pass in the application state.
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(initial_state)
        .expect("Failed to launch application");
}
examples/multiwin.rs (line 162)
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
    fn command(
        &mut self,
        ctx: &mut DelegateCtx,
        _target: Target,
        cmd: &Command,
        data: &mut State,
        _env: &Env,
    ) -> Handled {
        if cmd.is(sys_cmds::NEW_FILE) {
            let new_win = WindowDesc::new(ui_builder())
                .menu(make_menu)
                .window_size((data.selected as f64 * 100.0 + 300.0, 500.0));
            ctx.new_window(new_win);
            Handled::Yes
        } else {
            Handled::No
        }
    }
examples/calc.rs (line 250)
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
pub fn main() {
    let window = WindowDesc::new(build_calc())
        .window_size((223., 300.))
        .resizable(false)
        .title(
            LocalizedString::new("calc-demo-window-title").with_placeholder("Simple Calculator"),
        );
    let calc_state = CalcState {
        value: "0".to_string(),
        operand: 0.0,
        operator: 'C',
        in_num: false,
    };
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(calc_state)
        .expect("launch failed");
}
examples/hello.rs (line 37)
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pub fn main() {
    // describe the main window
    let main_window = WindowDesc::new(build_root_widget())
        .title("Hello World!")
        .window_size((400.0, 400.0));

    // create the initial app state
    let initial_state: HelloState = HelloState {
        name: "World".into(),
    };

    // start the application. Here we pass in the application state.
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(initial_state)
        .expect("Failed to launch application");
}
examples/slider.rs (line 40)
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pub fn main() {
    // describe the main window
    let main_window = WindowDesc::new(build_root_widget())
        .title("Slider Demo!")
        .window_size((400.0, 400.0));

    // create the initial app state
    let initial_state: AppState = AppState {
        range: (2.0, 8.0),
        value: 5.0,
    };

    // start the application. Here we pass in the application state.
    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(initial_state)
        .expect("Failed to launch application");
}
source

pub fn with_min_size(self, size: impl Into<Size>) -> Self

Set the window’s minimum drawing area size in display points.

The actual minimum window size in pixels will depend on the platform DPI settings.

This should be considered a request to the platform to set the minimum size of the window. The platform might increase the size a tiny bit due to DPI.

To set the window’s initial drawing area size use window_size.

Examples found in repository?
examples/timer.rs (line 127)
121
122
123
124
125
126
127
128
129
130
131
132
133
134
pub fn main() {
    let window = WindowDesc::new(TimerWidget {
        timer_id: TimerToken::INVALID,
        simple_box: WidgetPod::new(SimpleBox),
        pos: Point::ZERO,
    })
    .with_min_size((200., 200.))
    .title(LocalizedString::new("timer-demo-window-title").with_placeholder("Look at it go!"));

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(0u32)
        .expect("launch failed");
}
More examples
Hide additional examples
examples/input_region.rs (line 198)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
fn main() {
    let main_window = WindowDesc::new(InputRegionExampleWidget::new())
        .title("Input Region Demo")
        .window_size((750.0, 500.0))
        .with_min_size((650.0, 450.0))
        // Disable the titlebar since it breaks the desired effect on mac.
        // It can be turned on with the button, but not on mac.
        // A lot of apps that will use the interaction features will turn this off
        // On Windows, if on, this will be invisible, but still there.
        .show_titlebar(false)
        .transparent(true);

    let state = AppState {
        limit_input_region: true,
        always_on_top: false,
        show_titlebar: false,
    };

    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(state)
        .expect("Failed to launch application");
}
examples/flex.rs (line 326)
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
pub fn main() {
    let main_window = WindowDesc::new(make_ui())
        .window_size((720., 600.))
        .with_min_size((620., 300.))
        .title("Flex Container Options");

    let demo_state = DemoState {
        input_text: "hello".into(),
        enabled: false,
        volume: 0.0,
    };

    let params = Params {
        axis: FlexType::Row,
        cross_alignment: CrossAxisAlignment::Center,
        main_alignment: MainAxisAlignment::Start,
        debug_layout: false,
        fix_minor_axis: false,
        fix_major_axis: false,
        spacers: Spacers::None,
        spacer_size: DEFAULT_SPACER_SIZE,
        fill_major_axis: false,
    };

    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(AppState { demo_state, params })
        .expect("Failed to launch application");
}
source

pub fn resizable(self, resizable: bool) -> Self

Builder-style method to set whether this window can be resized.

Examples found in repository?
examples/transparency.rs (line 53)
48
49
50
51
52
53
54
55
56
57
58
59
60
pub fn main() {
    let window = WindowDesc::new(build_root_widget())
        .show_titlebar(false)
        .window_size((512., 512.))
        .transparent(true)
        .resizable(true)
        .title("Transparent background");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(HelloState { name: "".into() })
        .expect("launch failed");
}
More examples
Hide additional examples
examples/calc.rs (line 251)
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
pub fn main() {
    let window = WindowDesc::new(build_calc())
        .window_size((223., 300.))
        .resizable(false)
        .title(
            LocalizedString::new("calc-demo-window-title").with_placeholder("Simple Calculator"),
        );
    let calc_state = CalcState {
        value: "0".to_string(),
        operand: 0.0,
        operator: 'C',
        in_num: false,
    };
    AppLauncher::with_window(window)
        .log_to_console()
        .launch(calc_state)
        .expect("launch failed");
}
examples/game_of_life.rs (line 427)
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
pub fn main() {
    let window = WindowDesc::new(make_widget())
        .window_size(Size {
            width: 800.0,
            height: 800.0,
        })
        .resizable(false)
        .title("Game of Life");
    let mut grid = Grid::new();
    let pattern0 = glider(GridPos { row: 5, col: 5 });
    if let Some(x) = pattern0 {
        grid.set_alive(&x);
    }
    let pattern1 = blinker(GridPos { row: 29, col: 29 });
    if let Some(x) = pattern1 {
        grid.set_alive(&x);
    }

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(AppData {
            grid,
            drawing: false,
            paused: false,
            updates_per_second: 10.0,
        })
        .expect("launch failed");
}
source

pub fn show_titlebar(self, show_titlebar: bool) -> Self

Builder-style method to set whether this window’s titlebar is visible.

Examples found in repository?
examples/transparency.rs (line 50)
48
49
50
51
52
53
54
55
56
57
58
59
60
pub fn main() {
    let window = WindowDesc::new(build_root_widget())
        .show_titlebar(false)
        .window_size((512., 512.))
        .transparent(true)
        .resizable(true)
        .title("Transparent background");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(HelloState { name: "".into() })
        .expect("launch failed");
}
More examples
Hide additional examples
examples/input_region.rs (line 203)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
fn main() {
    let main_window = WindowDesc::new(InputRegionExampleWidget::new())
        .title("Input Region Demo")
        .window_size((750.0, 500.0))
        .with_min_size((650.0, 450.0))
        // Disable the titlebar since it breaks the desired effect on mac.
        // It can be turned on with the button, but not on mac.
        // A lot of apps that will use the interaction features will turn this off
        // On Windows, if on, this will be invisible, but still there.
        .show_titlebar(false)
        .transparent(true);

    let state = AppState {
        limit_input_region: true,
        always_on_top: false,
        show_titlebar: false,
    };

    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(state)
        .expect("Failed to launch application");
}
source

pub fn transparent(self, transparent: bool) -> Self

Builder-style method to set whether this window’s background should be transparent.

Examples found in repository?
examples/transparency.rs (line 52)
48
49
50
51
52
53
54
55
56
57
58
59
60
pub fn main() {
    let window = WindowDesc::new(build_root_widget())
        .show_titlebar(false)
        .window_size((512., 512.))
        .transparent(true)
        .resizable(true)
        .title("Transparent background");

    AppLauncher::with_window(window)
        .log_to_console()
        .launch(HelloState { name: "".into() })
        .expect("launch failed");
}
More examples
Hide additional examples
examples/input_region.rs (line 204)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
fn main() {
    let main_window = WindowDesc::new(InputRegionExampleWidget::new())
        .title("Input Region Demo")
        .window_size((750.0, 500.0))
        .with_min_size((650.0, 450.0))
        // Disable the titlebar since it breaks the desired effect on mac.
        // It can be turned on with the button, but not on mac.
        // A lot of apps that will use the interaction features will turn this off
        // On Windows, if on, this will be invisible, but still there.
        .show_titlebar(false)
        .transparent(true);

    let state = AppState {
        limit_input_region: true,
        always_on_top: false,
        show_titlebar: false,
    };

    AppLauncher::with_window(main_window)
        .log_to_console()
        .launch(state)
        .expect("Failed to launch application");
}
source

pub fn set_position(self, position: impl Into<Point>) -> Self

Sets the initial window position in display points, relative to the origin of the virtual screen.

source

pub fn set_level(self, level: WindowLevel) -> Self

Sets the WindowLevel of the window

source

pub fn set_always_on_top(self, always_on_top: bool) -> Self

Sets whether the window is always on top.

An always on top window stays on top, even after clicking off of it.

source

pub fn set_window_state(self, state: WindowState) -> Self

Set initial state for the window.

source

pub fn with_config(self, config: WindowConfig) -> Self

Set the WindowConfig of window.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for WindowDesc<T>

§

impl<T> !Send for WindowDesc<T>

§

impl<T> !Sync for WindowDesc<T>

§

impl<T> Unpin for WindowDesc<T>where T: Unpin,

§

impl<T> !UnwindSafe for WindowDesc<T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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.

§

impl<T> RoundFrom<T> for T

§

fn round_from(x: T) -> T

Performs the conversion.
§

impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,

§

fn round_into(self) -> U

Performs the conversion.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · 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