Window

Struct Window 

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

A window

Implementations§

Source§

impl Window

Source

pub fn new(x: i32, y: i32, w: u32, h: u32, title: &str) -> Option<Self>

Create a new window

Examples found in repository?
examples/rect_bench.rs (line 21)
20fn main() {
21    let mut window = Window::new(10, 10, 800, 600, "RECTANGLE BENCHMARK").unwrap();
22
23    time!("set", { window.set(Color::rgb(255, 255, 255)) });
24
25    time!("rect 400x400", {
26        window.rect(0, 0, 400, 400, Color::rgb(0, 0, 255))
27    });
28
29    time!("rect 200x200", {
30        window.rect(0, 0, 200, 200, Color::rgb(0, 255, 0))
31    });
32
33    time!("rect 100x100", {
34        window.rect(0, 0, 100, 100, Color::rgb(255, 0, 0))
35    });
36
37    time!("sync", {
38        window.sync();
39    });
40
41    'events: loop {
42        for event in window.events() {
43            #[allow(clippy::single_match)]
44            match event.to_option() {
45                EventOption::Quit(_quit_event) => break 'events,
46                _ => (),
47            }
48        }
49    }
50}
More examples
Hide additional examples
examples/image_bench.rs (line 25)
22fn main() {
23    //let (width, height) = orbclient::get_display_size().unwrap();
24
25    let mut window = Window::new(10, 10, 800, 600, "IMAGE BENCHMARK").unwrap();
26
27    window.set(Color::rgb(255, 255, 255));
28
29    //create image data : a green square
30    let data = vec![Color::rgba(100, 200, 10, 20); 412500];
31    let data2 = vec![Color::rgba(200, 100, 10, 20); 412500];
32    let data3 = vec![Color::rgba(10, 100, 100, 20); 412500];
33    let data4 = vec![Color::rgba(10, 100, 200, 20); 480000];
34
35    //draw image benchmarking
36    println!("Benchmarking implementations to draw an image on window:");
37
38    time!("image_legacy", {
39        for _i in 0..TIMES {
40            window.image_legacy(15, 15, 750, 550, &data[..]);
41        }
42    });
43
44    time!("image_fast", {
45        for _i in 0..TIMES {
46            window.image_fast(20, 20, 750, 550, &data2[..]);
47        }
48    });
49
50    time!("image_opaque", {
51        for _i in 0..TIMES {
52            window.image_opaque(50, 50, 750, 550, &data3[..]);
53        }
54    });
55
56    time!("image_over", {
57        for _i in 0..TIMES {
58            window.image_over(50, &data4[..360000]);
59        }
60    });
61
62    println!("------------------------------------------------");
63
64    window.sync();
65
66    'events: loop {
67        for event in window.events() {
68            match event.to_option() {
69                EventOption::Quit(_quit_event) => break 'events,
70                EventOption::Mouse(evt) => println!(
71                    "At position {:?} pixel color is : {:?}",
72                    (evt.x, evt.y),
73                    window.getpixel(evt.x, evt.y)
74                ),
75                event_option => println!("{:?}", event_option),
76            }
77        }
78    }
79}
examples/simple.rs (lines 8-14)
5fn main() {
6    let (width, height) = orbclient::get_display_size().unwrap();
7
8    let mut window = Window::new(
9        (width as i32) / 4,
10        (height as i32) / 4,
11        width / 2,
12        height / 2,
13        "TITLE",
14    )
15    .unwrap();
16
17    let (win_w, win_h) = (width / 2, height / 2);
18
19    // top left -> bottom rigth
20    window.linear_gradient(
21        0,
22        0,
23        win_w / 3,
24        win_h,
25        0,
26        0,
27        (win_w / 3) as i32,
28        (win_h / 2) as i32,
29        Color::rgb(128, 128, 128),
30        Color::rgb(255, 255, 255),
31    );
32    // horizontal gradient
33    window.linear_gradient(
34        (win_w / 3) as i32,
35        0,
36        win_w / 3,
37        win_h,
38        (win_w / 3) as i32,
39        0,
40        (2 * win_w / 3) as i32,
41        0,
42        Color::rgb(128, 255, 255),
43        Color::rgb(255, 255, 255),
44    );
45    // vertical gradient
46    window.linear_gradient(
47        (2 * win_w / 3) as i32,
48        0,
49        win_w / 3,
50        win_h,
51        (2 * win_w / 3) as i32,
52        0,
53        (2 * win_w / 3) as i32,
54        win_h as i32,
55        Color::rgb(0, 128, 0),
56        Color::rgb(255, 255, 255),
57    );
58    window.arc(100, 100, -25, 1 << 0 | 1 << 2, Color::rgb(0, 0, 255));
59    window.arc(100, 100, -25, 1 << 1 | 1 << 3, Color::rgb(0, 255, 255));
60    window.arc(100, 100, -25, 1 << 4 | 1 << 6, Color::rgb(255, 0, 255));
61    window.arc(100, 100, -25, 1 << 5 | 1 << 7, Color::rgb(255, 255, 0));
62    window.circle(100, 100, 25, Color::rgb(0, 0, 0));
63    window.circle(100, 101, -25, Color::rgb(0, 255, 0));
64    window.circle(220, 220, -100, Color::rgba(128, 128, 128, 80));
65    window.wu_circle(150, 220, 100, Color::rgba(255, 0, 0, 255));
66    window.line(0, 0, 200, 200, Color::rgb(255, 0, 0));
67    window.line(0, 200, 200, 0, Color::rgb(128, 255, 0));
68    // vertical and horizontal line test
69    window.line(100, 0, 100, 200, Color::rgb(0, 0, 255));
70    window.line(0, 100, 200, 100, Color::rgb(255, 255, 0));
71    window.wu_line(100, 220, 400, 250, Color::rgba(255, 0, 0, 255));
72    window.line(100, 230, 400, 260, Color::rgba(255, 0, 0, 255));
73
74    // path and bezier curve example draw a cloud
75    let mut cloud_path = GraphicsPath::new();
76    cloud_path.move_to(170, 80);
77    cloud_path.bezier_curve_to(130, 100, 130, 150, 230, 150);
78    cloud_path.bezier_curve_to(250, 180, 320, 180, 340, 150);
79    cloud_path.bezier_curve_to(420, 150, 420, 120, 390, 100);
80    cloud_path.bezier_curve_to(430, 40, 370, 30, 340, 50);
81    cloud_path.bezier_curve_to(320, 5, 250, 20, 250, 50);
82    cloud_path.bezier_curve_to(200, 5, 150, 20, 170, 80);
83    window.draw_path_stroke(cloud_path, Color::rgb(0, 0, 255));
84
85    // path and quadratic curve example draw a balloon
86    let mut balloon_path = GraphicsPath::new();
87    balloon_path.move_to(75, 25);
88    balloon_path.quadratic_curve_to(25, 25, 25, 62);
89    balloon_path.quadratic_curve_to(25, 100, 50, 100);
90    balloon_path.quadratic_curve_to(50, 120, 30, 125);
91    balloon_path.quadratic_curve_to(60, 120, 65, 100);
92    balloon_path.quadratic_curve_to(125, 100, 125, 62);
93    balloon_path.quadratic_curve_to(125, 25, 75, 25);
94    window.draw_path_stroke(balloon_path, Color::rgb(0, 0, 255));
95
96    window.char(200, 200, '═', Color::rgb(0, 0, 0));
97    window.char(208, 200, '═', Color::rgb(0, 0, 0));
98
99    // testing for non existent x,y position : does not panic but returns Color(0,0,0,0)
100    let _non_existent_pixel = window.getpixel(width as i32 + 10, height as i32 + 10);
101
102    // testing PartialEq for Color
103    if Color::rgb(11, 2, 3) == Color::rgba(1, 2, 3, 100) {
104        println!("Testing colors: they are the same!")
105    } else {
106        println!("Testing colors: they are NOT the same!")
107    }
108
109    //Draw a transparent rectangle over window content
110    // default mode is Blend
111    window.rect(250, 200, 80, 80, Color::rgba(100, 100, 100, 100));
112
113    //Draw an opaque rectangle replacing window content
114    window.mode().set(Mode::Overwrite); // set window drawing mode to Overwrite from now on
115    window.rect(300, 220, 80, 80, Color::rgb(100, 100, 100));
116
117    //Draw a hole in the window replacing alpha channel (Only in Orbital, not in SDL2)
118    window.rect(300, 100, 80, 80, Color::rgba(10, 10, 10, 1));
119
120    //Draw a transparent rectangle over window content
121    window.mode().set(Mode::Blend); //set mode to Blend fron now on
122    window.rect(200, 230, 80, 80, Color::rgba(100, 100, 100, 100));
123
124    //Draw a blured box over window content
125    window.box_blur(170, 100, 150, 150, 10);
126
127    //Draw a shadow around a box
128    window.box_shadow(170, 100, 150, 150, 0, 0, 20, Color::rgba(0, 0, 0, 255));
129
130    window.sync();
131
132    'events: loop {
133        for event in window.events() {
134            match event.to_option() {
135                EventOption::Quit(_quit_event) => break 'events,
136                EventOption::Mouse(evt) => println!(
137                    "At position {:?} pixel color is : {:?}",
138                    (evt.x, evt.y),
139                    window.getpixel(evt.x, evt.y)
140                ),
141                event_option => println!("{:?}", event_option),
142            }
143        }
144    }
145}
Source

pub fn new_flags( x: i32, y: i32, w: u32, h: u32, title: &str, flags: &[WindowFlag], ) -> Option<Self>

Create a new window with flags

Source

pub fn event_sender(&self) -> EventSender

Source

pub fn clipboard(&self) -> String

Source

pub fn set_clipboard(&mut self, text: &str)

Source

pub fn pop_drop_content(&self) -> Option<String>

Pops the content of the last drop event from the window.

Source

pub fn sync_path(&mut self)

Source

pub fn x(&self) -> i32

Get x

Source

pub fn y(&self) -> i32

Get y

Source

pub fn title(&self) -> String

Get title

Source

pub fn is_async(&self) -> bool

Get async

Source

pub fn set_async(&mut self, is_async: bool)

Set async

Source

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

Set cursor visibility

Source

pub fn set_mouse_grab(&mut self, grab: bool)

Set mouse grabbing

Source

pub fn set_mouse_relative(&mut self, relative: bool)

Set mouse relative mode

Source

pub fn set_pos(&mut self, x: i32, y: i32)

Set position

Source

pub fn set_size(&mut self, width: u32, height: u32)

Set size

Source

pub fn set_title(&mut self, title: &str)

Set title

Source

pub fn events(&mut self) -> EventIter

Blocking iterator over events

Examples found in repository?
examples/rect_bench.rs (line 42)
20fn main() {
21    let mut window = Window::new(10, 10, 800, 600, "RECTANGLE BENCHMARK").unwrap();
22
23    time!("set", { window.set(Color::rgb(255, 255, 255)) });
24
25    time!("rect 400x400", {
26        window.rect(0, 0, 400, 400, Color::rgb(0, 0, 255))
27    });
28
29    time!("rect 200x200", {
30        window.rect(0, 0, 200, 200, Color::rgb(0, 255, 0))
31    });
32
33    time!("rect 100x100", {
34        window.rect(0, 0, 100, 100, Color::rgb(255, 0, 0))
35    });
36
37    time!("sync", {
38        window.sync();
39    });
40
41    'events: loop {
42        for event in window.events() {
43            #[allow(clippy::single_match)]
44            match event.to_option() {
45                EventOption::Quit(_quit_event) => break 'events,
46                _ => (),
47            }
48        }
49    }
50}
More examples
Hide additional examples
examples/image_bench.rs (line 67)
22fn main() {
23    //let (width, height) = orbclient::get_display_size().unwrap();
24
25    let mut window = Window::new(10, 10, 800, 600, "IMAGE BENCHMARK").unwrap();
26
27    window.set(Color::rgb(255, 255, 255));
28
29    //create image data : a green square
30    let data = vec![Color::rgba(100, 200, 10, 20); 412500];
31    let data2 = vec![Color::rgba(200, 100, 10, 20); 412500];
32    let data3 = vec![Color::rgba(10, 100, 100, 20); 412500];
33    let data4 = vec![Color::rgba(10, 100, 200, 20); 480000];
34
35    //draw image benchmarking
36    println!("Benchmarking implementations to draw an image on window:");
37
38    time!("image_legacy", {
39        for _i in 0..TIMES {
40            window.image_legacy(15, 15, 750, 550, &data[..]);
41        }
42    });
43
44    time!("image_fast", {
45        for _i in 0..TIMES {
46            window.image_fast(20, 20, 750, 550, &data2[..]);
47        }
48    });
49
50    time!("image_opaque", {
51        for _i in 0..TIMES {
52            window.image_opaque(50, 50, 750, 550, &data3[..]);
53        }
54    });
55
56    time!("image_over", {
57        for _i in 0..TIMES {
58            window.image_over(50, &data4[..360000]);
59        }
60    });
61
62    println!("------------------------------------------------");
63
64    window.sync();
65
66    'events: loop {
67        for event in window.events() {
68            match event.to_option() {
69                EventOption::Quit(_quit_event) => break 'events,
70                EventOption::Mouse(evt) => println!(
71                    "At position {:?} pixel color is : {:?}",
72                    (evt.x, evt.y),
73                    window.getpixel(evt.x, evt.y)
74                ),
75                event_option => println!("{:?}", event_option),
76            }
77        }
78    }
79}
examples/simple.rs (line 133)
5fn main() {
6    let (width, height) = orbclient::get_display_size().unwrap();
7
8    let mut window = Window::new(
9        (width as i32) / 4,
10        (height as i32) / 4,
11        width / 2,
12        height / 2,
13        "TITLE",
14    )
15    .unwrap();
16
17    let (win_w, win_h) = (width / 2, height / 2);
18
19    // top left -> bottom rigth
20    window.linear_gradient(
21        0,
22        0,
23        win_w / 3,
24        win_h,
25        0,
26        0,
27        (win_w / 3) as i32,
28        (win_h / 2) as i32,
29        Color::rgb(128, 128, 128),
30        Color::rgb(255, 255, 255),
31    );
32    // horizontal gradient
33    window.linear_gradient(
34        (win_w / 3) as i32,
35        0,
36        win_w / 3,
37        win_h,
38        (win_w / 3) as i32,
39        0,
40        (2 * win_w / 3) as i32,
41        0,
42        Color::rgb(128, 255, 255),
43        Color::rgb(255, 255, 255),
44    );
45    // vertical gradient
46    window.linear_gradient(
47        (2 * win_w / 3) as i32,
48        0,
49        win_w / 3,
50        win_h,
51        (2 * win_w / 3) as i32,
52        0,
53        (2 * win_w / 3) as i32,
54        win_h as i32,
55        Color::rgb(0, 128, 0),
56        Color::rgb(255, 255, 255),
57    );
58    window.arc(100, 100, -25, 1 << 0 | 1 << 2, Color::rgb(0, 0, 255));
59    window.arc(100, 100, -25, 1 << 1 | 1 << 3, Color::rgb(0, 255, 255));
60    window.arc(100, 100, -25, 1 << 4 | 1 << 6, Color::rgb(255, 0, 255));
61    window.arc(100, 100, -25, 1 << 5 | 1 << 7, Color::rgb(255, 255, 0));
62    window.circle(100, 100, 25, Color::rgb(0, 0, 0));
63    window.circle(100, 101, -25, Color::rgb(0, 255, 0));
64    window.circle(220, 220, -100, Color::rgba(128, 128, 128, 80));
65    window.wu_circle(150, 220, 100, Color::rgba(255, 0, 0, 255));
66    window.line(0, 0, 200, 200, Color::rgb(255, 0, 0));
67    window.line(0, 200, 200, 0, Color::rgb(128, 255, 0));
68    // vertical and horizontal line test
69    window.line(100, 0, 100, 200, Color::rgb(0, 0, 255));
70    window.line(0, 100, 200, 100, Color::rgb(255, 255, 0));
71    window.wu_line(100, 220, 400, 250, Color::rgba(255, 0, 0, 255));
72    window.line(100, 230, 400, 260, Color::rgba(255, 0, 0, 255));
73
74    // path and bezier curve example draw a cloud
75    let mut cloud_path = GraphicsPath::new();
76    cloud_path.move_to(170, 80);
77    cloud_path.bezier_curve_to(130, 100, 130, 150, 230, 150);
78    cloud_path.bezier_curve_to(250, 180, 320, 180, 340, 150);
79    cloud_path.bezier_curve_to(420, 150, 420, 120, 390, 100);
80    cloud_path.bezier_curve_to(430, 40, 370, 30, 340, 50);
81    cloud_path.bezier_curve_to(320, 5, 250, 20, 250, 50);
82    cloud_path.bezier_curve_to(200, 5, 150, 20, 170, 80);
83    window.draw_path_stroke(cloud_path, Color::rgb(0, 0, 255));
84
85    // path and quadratic curve example draw a balloon
86    let mut balloon_path = GraphicsPath::new();
87    balloon_path.move_to(75, 25);
88    balloon_path.quadratic_curve_to(25, 25, 25, 62);
89    balloon_path.quadratic_curve_to(25, 100, 50, 100);
90    balloon_path.quadratic_curve_to(50, 120, 30, 125);
91    balloon_path.quadratic_curve_to(60, 120, 65, 100);
92    balloon_path.quadratic_curve_to(125, 100, 125, 62);
93    balloon_path.quadratic_curve_to(125, 25, 75, 25);
94    window.draw_path_stroke(balloon_path, Color::rgb(0, 0, 255));
95
96    window.char(200, 200, '═', Color::rgb(0, 0, 0));
97    window.char(208, 200, '═', Color::rgb(0, 0, 0));
98
99    // testing for non existent x,y position : does not panic but returns Color(0,0,0,0)
100    let _non_existent_pixel = window.getpixel(width as i32 + 10, height as i32 + 10);
101
102    // testing PartialEq for Color
103    if Color::rgb(11, 2, 3) == Color::rgba(1, 2, 3, 100) {
104        println!("Testing colors: they are the same!")
105    } else {
106        println!("Testing colors: they are NOT the same!")
107    }
108
109    //Draw a transparent rectangle over window content
110    // default mode is Blend
111    window.rect(250, 200, 80, 80, Color::rgba(100, 100, 100, 100));
112
113    //Draw an opaque rectangle replacing window content
114    window.mode().set(Mode::Overwrite); // set window drawing mode to Overwrite from now on
115    window.rect(300, 220, 80, 80, Color::rgb(100, 100, 100));
116
117    //Draw a hole in the window replacing alpha channel (Only in Orbital, not in SDL2)
118    window.rect(300, 100, 80, 80, Color::rgba(10, 10, 10, 1));
119
120    //Draw a transparent rectangle over window content
121    window.mode().set(Mode::Blend); //set mode to Blend fron now on
122    window.rect(200, 230, 80, 80, Color::rgba(100, 100, 100, 100));
123
124    //Draw a blured box over window content
125    window.box_blur(170, 100, 150, 150, 10);
126
127    //Draw a shadow around a box
128    window.box_shadow(170, 100, 150, 150, 0, 0, 20, Color::rgba(0, 0, 0, 255));
129
130    window.sync();
131
132    'events: loop {
133        for event in window.events() {
134            match event.to_option() {
135                EventOption::Quit(_quit_event) => break 'events,
136                EventOption::Mouse(evt) => println!(
137                    "At position {:?} pixel color is : {:?}",
138                    (evt.x, evt.y),
139                    window.getpixel(evt.x, evt.y)
140                ),
141                event_option => println!("{:?}", event_option),
142            }
143        }
144    }
145}
Source

pub fn id(&self) -> u32

Returns the id

Trait Implementations§

Source§

impl AsRawFd for Window

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl Drop for Window

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FromRawFd for Window

Source§

unsafe fn from_raw_fd(_fd: RawFd) -> Window

Constructs a new instance of Self from the given raw file descriptor. Read more
Source§

impl IntoRawFd for Window

Source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more
Source§

impl Renderer for Window

Source§

fn width(&self) -> u32

Get width

Source§

fn height(&self) -> u32

Get height

Source§

fn data(&self) -> &[Color]

Access pixel buffer

Source§

fn data_mut(&mut self) -> &mut [Color]

Access pixel buffer mutably

Source§

fn sync(&mut self) -> bool

Flip the window buffer

Source§

fn mode(&self) -> &Cell<Mode>

Set/get mode

Source§

fn pixel(&mut self, x: i32, y: i32, color: Color)

Draw a pixel
Source§

fn arc(&mut self, x0: i32, y0: i32, radius: i32, parts: u8, color: Color)

Draw a piece of an arc. Negative radius will fill in the inside
Source§

fn circle(&mut self, x0: i32, y0: i32, radius: i32, color: Color)

Draw a circle. Negative radius will fill in the inside
Source§

fn line4points(&mut self, x0: i32, y0: i32, x: i32, y: i32, color: Color)

Source§

fn line(&mut self, argx1: i32, argy1: i32, argx2: i32, argy2: i32, color: Color)

Draw a line
Source§

fn lines(&mut self, points: &[[i32; 2]], color: Color)

Source§

fn draw_path_stroke(&mut self, graphicspath: GraphicsPath, color: Color)

Draw a path (GraphicsPath)
Source§

fn char(&mut self, x: i32, y: i32, c: char, color: Color)

Draw a character, using the loaded font
Source§

fn set(&mut self, color: Color)

Set entire window to a color
Source§

fn clear(&mut self)

Sets the whole window to black
Source§

fn rect(&mut self, x: i32, y: i32, w: u32, h: u32, color: Color)

Source§

fn box_blur(&mut self, x: i32, y: i32, w: u32, h: u32, r: i32)

Source§

fn box_shadow( &mut self, x: i32, y: i32, w: u32, h: u32, offset_x: i32, offset_y: i32, r: i32, color: Color, )

Source§

fn image(&mut self, start_x: i32, start_y: i32, w: u32, h: u32, data: &[Color])

Display an image
Source§

fn image_legacy( &mut self, start_x: i32, start_y: i32, w: u32, h: u32, data: &[Color], )

Source§

fn image_over(&mut self, start: i32, image_data: &[Color])

Display an image overwriting a portion of window starting at given line : very quick!!
Source§

fn image_opaque( &mut self, start_x: i32, start_y: i32, w: u32, h: u32, image_data: &[Color], )

Display an image using non transparent method
Source§

fn image_fast( &mut self, start_x: i32, start_y: i32, w: u32, h: u32, image_data: &[Color], )

Source§

fn linear_gradient( &mut self, rect_x: i32, rect_y: i32, rect_width: u32, rect_height: u32, start_x: i32, start_y: i32, end_x: i32, end_y: i32, start_color: Color, end_color: Color, )

Draw a linear gradient in a rectangular region
Source§

fn rounded_rect( &mut self, x: i32, y: i32, w: u32, h: u32, radius: u32, filled: bool, color: Color, )

Draw a rect with rounded corners
Source§

fn wu_line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: Color)

Draws antialiased line
Source§

fn wu_circle(&mut self, x0: i32, y0: i32, radius: i32, color: Color)

Draws antialiased circle
Source§

fn getpixel(&self, x: i32, y: i32) -> Color

Gets pixel color at x,y position

Auto Trait Implementations§

§

impl !Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl UnwindSafe for Window

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.