Camera

Struct Camera 

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

A structure representing a camera connected to the system.

Implementations§

Source§

impl Camera

Source

pub fn autodetect(context: &mut Context) -> Result<Self>

Opens the first detected camera.

Examples found in repository?
examples/capture.rs (line 14)
5fn main() {
6    let mut context = match gphoto::Context::new() {
7        Ok(c) => c,
8        Err(err) => panic!("error creating context: {}", err)
9    };
10
11    // open camera
12
13    println!("opening camera ...");
14    let mut camera = match gphoto::Camera::autodetect(&mut context) {
15        Ok(c) => c,
16        Err(err) => panic!("error opening camera: {}", err)
17    };
18    println!(" (done)");
19
20    // capture image
21
22    println!("capturing image ...");
23    let capture = match camera.capture_image(&mut context) {
24        Ok(c) => c,
25        Err(err) => panic!("error capturing image: {}", err)
26    };
27    println!(" (done) {:?}", capture.basename());
28
29    // download file
30
31    let mut file = match gphoto::FileMedia::create(Path::new(capture.basename().as_ref())) {
32        Ok(f) => f,
33        Err(err) => panic!("error saving file: {}", err)
34    };
35
36    println!("downloading ...");
37    if let Err(err) = camera.download(&mut context, &capture, &mut file) {
38        panic!("error downloading file: {}", err);
39    }
40    println!(" (done)");
41}
More examples
Hide additional examples
examples/camera_info.rs (line 9)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn capture_image(&mut self, context: &mut Context) -> Result<CameraFile>

Captures an image.

Examples found in repository?
examples/capture.rs (line 23)
5fn main() {
6    let mut context = match gphoto::Context::new() {
7        Ok(c) => c,
8        Err(err) => panic!("error creating context: {}", err)
9    };
10
11    // open camera
12
13    println!("opening camera ...");
14    let mut camera = match gphoto::Camera::autodetect(&mut context) {
15        Ok(c) => c,
16        Err(err) => panic!("error opening camera: {}", err)
17    };
18    println!(" (done)");
19
20    // capture image
21
22    println!("capturing image ...");
23    let capture = match camera.capture_image(&mut context) {
24        Ok(c) => c,
25        Err(err) => panic!("error capturing image: {}", err)
26    };
27    println!(" (done) {:?}", capture.basename());
28
29    // download file
30
31    let mut file = match gphoto::FileMedia::create(Path::new(capture.basename().as_ref())) {
32        Ok(f) => f,
33        Err(err) => panic!("error saving file: {}", err)
34    };
35
36    println!("downloading ...");
37    if let Err(err) = camera.download(&mut context, &capture, &mut file) {
38        panic!("error downloading file: {}", err);
39    }
40    println!(" (done)");
41}
Source

pub fn download<T: Media>( &mut self, context: &mut Context, source: &CameraFile, destination: &mut T, ) -> Result<()>

Downloads a file from the camera.

Examples found in repository?
examples/capture.rs (line 37)
5fn main() {
6    let mut context = match gphoto::Context::new() {
7        Ok(c) => c,
8        Err(err) => panic!("error creating context: {}", err)
9    };
10
11    // open camera
12
13    println!("opening camera ...");
14    let mut camera = match gphoto::Camera::autodetect(&mut context) {
15        Ok(c) => c,
16        Err(err) => panic!("error opening camera: {}", err)
17    };
18    println!(" (done)");
19
20    // capture image
21
22    println!("capturing image ...");
23    let capture = match camera.capture_image(&mut context) {
24        Ok(c) => c,
25        Err(err) => panic!("error capturing image: {}", err)
26    };
27    println!(" (done) {:?}", capture.basename());
28
29    // download file
30
31    let mut file = match gphoto::FileMedia::create(Path::new(capture.basename().as_ref())) {
32        Ok(f) => f,
33        Err(err) => panic!("error saving file: {}", err)
34    };
35
36    println!("downloading ...");
37    if let Err(err) = camera.download(&mut context, &capture, &mut file) {
38        panic!("error downloading file: {}", err);
39    }
40    println!(" (done)");
41}
Source

pub fn port<'a>(&'a self) -> Port<'a>

Returns information about the port the camera is connected to.

Examples found in repository?
examples/camera_info.rs (line 15)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn abilities(&self) -> Abilities

Retrieves the camera’s abilities.

Examples found in repository?
examples/camera_info.rs (line 23)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn storage(&mut self, context: &mut Context) -> Result<Vec<Storage>>

Retrieves information about the camera’s storage.

Returns a Vec containing one Storage for each filesystem on the device.

Examples found in repository?
examples/camera_info.rs (line 40)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn summary(&mut self, context: &mut Context) -> Result<String>

Returns the camera’s summary.

The summary typically contains non-configurable information about the camera, such as manufacturer and number of pictures taken.

§Errors

This function returns an error if the summary could not be retrieved:

  • NotSupported if there is no summary available for the camera.
  • CorruptedData if the summary is invalid UTF-8.
Examples found in repository?
examples/camera_info.rs (line 58)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn manual(&mut self, context: &mut Context) -> Result<String>

Returns the camera’s manual.

The manual contains information about using the camera.

§Errors

This function returns an error if the manual could not be retrieved:

  • NotSupported if there is no manual available for the camera.
  • CorruptedData if the summary is invalid UTF-8.
Examples found in repository?
examples/camera_info.rs (line 62)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}
Source

pub fn about_driver(&mut self, context: &mut Context) -> Result<String>

Returns information about the camera driver.

This text typically contains information about the driver’s author, acknowledgements, etc.

§Errors

This function returns an error if the about text could not be retrieved:

  • NotSupported if there is no about text available for the camera’s driver.
  • CorruptedData if the summary is invalid UTF-8.
Examples found in repository?
examples/camera_info.rs (line 66)
3fn main() {
4    let mut context = match gphoto::Context::new() {
5        Ok(c) => c,
6        Err(err) => panic!("error creating context: {}", err)
7    };
8
9    let mut camera = match gphoto::Camera::autodetect(&mut context) {
10        Ok(c) => c,
11        Err(err) => panic!("error opening camera: {}", err)
12    };
13
14    {
15        let port = camera.port();
16
17        println!("[port info]");
18        println!("port type = {:?}", port.port_type());
19        println!("port name = {:?}", port.name());
20        println!("port path = {:?}", port.path());
21    }
22
23    let abilities = camera.abilities();
24
25    println!("\n[abilities]");
26    println!("      device type = {:?}", abilities.device_type());
27    println!("            model = {:?}", abilities.model());
28    println!("    driver status = {:?}", abilities.driver_status());
29    println!("       port types = {:?}", abilities.port_types());
30    println!("           speeds = {:?}", abilities.speeds());
31    println!("camera operations = {:?}", abilities.camera_operations());
32    println!("  file operations = {:?}", abilities.file_operations());
33    println!("folder operations = {:?}", abilities.folder_operations());
34    println!("       USB vendor = {:?}", abilities.usb_vendor());
35    println!("      USB product = {:?}", abilities.usb_product());
36    println!("        USB class = {:?}", abilities.usb_class());
37    println!("     USB subclass = {:?}", abilities.usb_subclass());
38    println!("     USB protocol = {:?}", abilities.usb_protocol());
39
40    match camera.storage(&mut context) {
41        Ok(storage) => {
42            for s in storage {
43                println!("\n[storage]");
44                println!("       base dir = {:?}", s.base_dir());
45                println!("          label = {:?}", s.label());
46                println!("    description = {:?}", s.description());
47                println!("   storage type = {:?}", s.storage_type());
48                println!("filesystem type = {:?}", s.filesystem_type());
49                println!("    access type = {:?}", s.access_type());
50                println!("    capacity kb = {:?}", s.capacity_kbytes());
51                println!("        free kb = {:?}", s.free_kbytes());
52                println!("    free images = {:?}", s.free_images());
53            }
54        },
55        Err(err) => println!("\ncould not retrieve storage information: {}", err)
56    }
57
58    if let Ok(s) = camera.summary(&mut context) {
59        println!("\n[summary]\n{}", s);
60    }
61
62    if let Ok(s) = camera.manual(&mut context) {
63        println!("\n[manual]\n{}", s);
64    }
65
66    if let Ok(s) = camera.about_driver(&mut context) {
67        println!("\n[driver]\n{}", s);
68    }
69}

Trait Implementations§

Source§

impl Drop for Camera

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Camera

§

impl RefUnwindSafe for Camera

§

impl !Send for Camera

§

impl !Sync for Camera

§

impl Unpin for Camera

§

impl UnwindSafe for Camera

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.