DiscId

Struct DiscId 

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

DiscId holds information about a disc (TOC, MCN, ISRCs).

Use DiscId::read, DiscId::read_features, DiscId::put or DiscId::parse to initialize an instance of DiscId.

Internally this type uses libdiscid handles which must not be accessed concurrently or moved across threads. Consequently, DiscId does not implement Send or Sync.

Implementations§

Source§

impl DiscId

Source

pub fn read(device: Option<&str>) -> Result<Self, DiscError>

Read the disc in the given CD-ROM/DVD-ROM drive extracting only the TOC.

This function reads the disc in the drive specified by the given device identifier. If the device is None, the default device, as returned by DiscId::default_device, is used.

This function will only read the TOC, hence only the disc ID itself will be available. Use DiscId::read_features if you want to read also MCN and ISRCs.

§Errors

Will return Err if reading the disc failed for any reason, e.g. no CD drive available or no disc inserted.

§Examples

Read from default device

use discid::DiscId;

let disc = DiscId::read(None).expect("Reading disc failed");
println!("ID: {}", disc.id());

Read from specific device

let disc = DiscId::read(Some("/dev/sr1")).expect("Reading disc failed");
println!("ID: {}", disc.id());
Source

pub fn read_features( device: Option<&str>, features: Features, ) -> Result<Self, DiscError>

Read the disc in the given CD-ROM/DVD-ROM drive with additional features.

This function is similar to DiscId::read but allows to read information about MCN and per-track ISRCs in addition to the normal TOC data.

The parameter features accepts a bitwise combination of values defined in Features. Features::READ is always implied, so it is not necessary to specify it.

Reading MCN and ISRCs is not available on all platforms. You can use the has_feature method to check if a specific feature is available. Passing unsupported features here will just be ignored.

Note that reading MCN and ISRC data is significantly slower than just reading the TOC, so only request the features you actually need.

§Errors

Will return Err if reading the disc failed for any reason, e.g. no CD drive available or no disc inserted.

§Examples

Read both ISRC and MCN from default device

use discid::{DiscId, Features};

let features = Features::MCN | Features::ISRC;
let disc = DiscId::read_features(None, features).expect("Reading disc failed");
println!("ID : {}", disc.id());
println!("MCN: {}", disc.mcn());
for track in disc.tracks() {
    println!("#{} ISRC: {}", track.number, track.isrc);
}
Examples found in repository?
examples/readisrcs.rs (line 4)
3fn main() {
4    let result = DiscId::read_features(None, Features::ISRC);
5
6    match result {
7        Ok(disc) => {
8            println!("Disc ID: {}", disc.id());
9
10            for track in disc.tracks() {
11                println!("Track #{} ISRC: {}", track.number, track.isrc);
12            }
13        }
14        Err(e) => {
15            eprintln!("{}", e);
16            std::process::exit(1);
17        }
18    }
19}
More examples
Hide additional examples
examples/readdiscid.rs (line 12)
4fn main() {
5    // Read the device name from the command line or use the default.
6    let arg1 = env::args().nth(1).unwrap_or_default();
7    let device = if !arg1.is_empty() {
8        Some(&arg1[..])
9    } else {
10        None
11    };
12    let result = DiscId::read_features(device, Features::all());
13
14    match result {
15        Ok(disc) => print_disc_info(disc),
16        Err(e) => {
17            eprintln!("{}", e);
18            std::process::exit(1);
19        }
20    }
21}
Source

pub fn put(first: i32, offsets: &[i32]) -> Result<Self, DiscError>

Provides the TOC of a known CD.

This function may be used if the TOC has been read earlier and you want to calculate the disc ID afterwards, without accessing the disc drive.

first is the track number of the first track (1-99). The offsets parameter points to an array which contains the track offsets for each track. The first element, offsets[0], is the lead-out track. It must contain the total number of sectors on the disc. offsets must not be longer than 100 elements (lead-out + 99 tracks).

§Errors

Will return Err if the provided offsets are invalid.

§Examples:
use discid::DiscId;

let first_track = 1;
// The offsets contain the total number of sectors as first element, followed by
// the start sectors of each track.
let offsets = [
   242457, 150, 44942, 61305, 72755, 96360, 130485, 147315, 164275, 190702, 205412, 220437,
];
let disc = DiscId::put(first_track, &offsets).expect("DiscId::put() failed");
assert_eq!("lSOVc5h6IXSuzcamJS1Gp4_tRuA-", disc.id());
Examples found in repository?
examples/discfromtoc.rs (line 7)
3fn main() {
4    let offsets = [
5        242457, 150, 44942, 61305, 72755, 96360, 130485, 147315, 164275, 190702, 205412, 220437,
6    ];
7    let result = DiscId::put(1, &offsets);
8
9    match result {
10        Ok(disc) => print_disc_info(disc),
11        Err(e) => {
12            eprintln!("{}", e);
13            std::process::exit(1);
14        }
15    }
16}
Source

pub fn parse(toc: &str) -> Result<Self, DiscError>

Parses a TOC string and returns a DiscId instance for it.

The TOC string provided here must have the same format as returned by toc_string.

This function can be used if you already have a TOC string like e.g. 1 11 242457 150 44942 61305 72755 96360 130485 147315 164275 190702 205412 220437.

§Errors

Will return Err if the provided toc is invalid.

§Examples:
use discid::DiscId;

let toc = "1 11 242457 150 44942 61305 72755 96360 130485 147315 164275 190702 205412 220437";
let disc = DiscId::parse(toc).expect("DiscId::put() failed");
assert_eq!("lSOVc5h6IXSuzcamJS1Gp4_tRuA-", disc.id());
assert_eq!(toc, disc.toc_string());
Examples found in repository?
examples/parsetoc.rs (line 5)
3fn main() {
4    let toc = "1 11 242457 150 44942 61305 72755 96360 130485 147315 164275 190702 205412 220437";
5    let result = DiscId::parse(toc);
6
7    match result {
8        Ok(disc) => print_disc_info(disc),
9        Err(e) => {
10            eprintln!("{}", e);
11            std::process::exit(1);
12        }
13    }
14}
Source

pub fn has_feature(feature: Features) -> bool

Check if a certain feature is implemented on the current platform.

Support for multiple features can be tested by providing a bit masks of features. The function will return true only if all features are supported.

See the libdiscid feature matrix for a list of supported features per platform.

§Examples

Check for a single feature:

use discid::{DiscId, Features};

let can_read = DiscId::has_feature(Features::READ);
assert!(can_read);

Check support of multiple features:

use discid::{DiscId, Features};

let can_read = DiscId::has_feature(Features::READ | Features::ISRC);
assert!(can_read);
Source

pub fn version_string() -> String

Return version information about libdiscid.

The returned string will be e.g. "libdiscid 0.6.2".

§Examples
use discid::DiscId;

println!("{}", DiscId::version_string());
Examples found in repository?
examples/discidinfo.rs (line 4)
3fn main() {
4    println!("Version       : {}", DiscId::version_string());
5    println!("Default device: {}", DiscId::default_device());
6}
Source

pub fn default_device() -> String

Return the name of the default disc drive for this operating system.

The default device is system dependent, e.g. /dev/cdrom on Linux and D: on Windows.

§Examples
use discid::DiscId;

println!("{}", DiscId::default_device());
Examples found in repository?
examples/discidinfo.rs (line 5)
3fn main() {
4    println!("Version       : {}", DiscId::version_string());
5    println!("Default device: {}", DiscId::default_device());
6}
Source

pub fn id(&self) -> String

The MusicBrainz disc ID.

Examples found in repository?
examples/discfromtoc.rs (line 19)
18fn print_disc_info(disc: DiscId) {
19    println!("DiscId: {}", disc.id());
20    println!("TOC   : {}", disc.toc_string());
21    println!("\nSubmit via {}", disc.submission_url());
22}
More examples
Hide additional examples
examples/readisrcs.rs (line 8)
3fn main() {
4    let result = DiscId::read_features(None, Features::ISRC);
5
6    match result {
7        Ok(disc) => {
8            println!("Disc ID: {}", disc.id());
9
10            for track in disc.tracks() {
11                println!("Track #{} ISRC: {}", track.number, track.isrc);
12            }
13        }
14        Err(e) => {
15            eprintln!("{}", e);
16            std::process::exit(1);
17        }
18    }
19}
examples/parsetoc.rs (line 17)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
examples/readdiscid.rs (line 24)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn freedb_id(&self) -> String

The FreeDB disc ID.

Examples found in repository?
examples/parsetoc.rs (line 18)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
More examples
Hide additional examples
examples/readdiscid.rs (line 25)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn toc_string(&self) -> String

Return a string representing CD Table Of Contents (TOC).

The TOC string is a list of integers separated by a single space character. The integers represent (in order):

  • First track number (normally one)
  • Last track number
  • Lead-out track offset
  • Up to 99 frame offsets

See also DiscId::parse and the documentation for Disc ID Calculation.

Examples found in repository?
examples/discfromtoc.rs (line 20)
18fn print_disc_info(disc: DiscId) {
19    println!("DiscId: {}", disc.id());
20    println!("TOC   : {}", disc.toc_string());
21    println!("\nSubmit via {}", disc.submission_url());
22}
More examples
Hide additional examples
examples/parsetoc.rs (line 19)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
examples/readdiscid.rs (line 26)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn submission_url(&self) -> String

An URL for submitting the DiscID to MusicBrainz.

Examples found in repository?
examples/discfromtoc.rs (line 21)
18fn print_disc_info(disc: DiscId) {
19    println!("DiscId: {}", disc.id());
20    println!("TOC   : {}", disc.toc_string());
21    println!("\nSubmit via {}", disc.submission_url());
22}
More examples
Hide additional examples
examples/parsetoc.rs (line 30)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
Source

pub fn first_track_num(&self) -> i32

The number of the first track on this disc.

Examples found in repository?
examples/parsetoc.rs (line 20)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
More examples
Hide additional examples
examples/readdiscid.rs (line 28)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn last_track_num(&self) -> i32

The number of the last track on this disc.

Examples found in repository?
examples/parsetoc.rs (line 21)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
More examples
Hide additional examples
examples/readdiscid.rs (line 29)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn sectors(&self) -> i32

The length of the disc in sectors.

Examples found in repository?
examples/parsetoc.rs (line 22)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
More examples
Hide additional examples
examples/readdiscid.rs (line 30)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn mcn(&self) -> String

The media catalogue number on the disc, if present.

Examples found in repository?
examples/readdiscid.rs (line 27)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn tracks(&self) -> TrackIter

Returns an iterator to access information about each track on the disc.

Returns an instance of Track for each track.

§Examples
use discid::DiscId;

let offsets = [
   242457, 150, 44942, 61305, 72755, 96360, 130485, 147315, 164275, 190702, 205412, 220437,
];
let disc = DiscId::put(1, &offsets).expect("DiscId::put() failed");
for track in disc.tracks() {
    println!("Track #{}", track.number);
    println!("    ISRC    : {}", track.isrc);
    println!("    Offset  : {}", track.offset);
    println!("    Sectors : {}", track.sectors);
}
Examples found in repository?
examples/readisrcs.rs (line 10)
3fn main() {
4    let result = DiscId::read_features(None, Features::ISRC);
5
6    match result {
7        Ok(disc) => {
8            println!("Disc ID: {}", disc.id());
9
10            for track in disc.tracks() {
11                println!("Track #{} ISRC: {}", track.number, track.isrc);
12            }
13        }
14        Err(e) => {
15            eprintln!("{}", e);
16            std::process::exit(1);
17        }
18    }
19}
More examples
Hide additional examples
examples/parsetoc.rs (line 24)
16fn print_disc_info(disc: DiscId) {
17    println!("DiscID      : {}", disc.id());
18    println!("FreeDB ID   : {}", disc.freedb_id());
19    println!("TOC         : {}", disc.toc_string());
20    println!("First track : {}", disc.first_track_num());
21    println!("Last track  : {}", disc.last_track_num());
22    println!("Sectors     : {}\n", disc.sectors());
23
24    for track in disc.tracks() {
25        println!("Track #{}", track.number);
26        println!("    Offset  : {}", track.offset);
27        println!("    Sectors : {}", track.sectors);
28    }
29
30    println!("\nSubmit via {}", disc.submission_url());
31}
examples/readdiscid.rs (line 32)
23fn print_disc_info(disc: DiscId) {
24    println!("DiscID      : {}", disc.id());
25    println!("FreeDB ID   : {}", disc.freedb_id());
26    println!("TOC         : {}", disc.toc_string());
27    println!("MCN         : {}", disc.mcn());
28    println!("First track : {}", disc.first_track_num());
29    println!("Last track  : {}", disc.last_track_num());
30    println!("Sectors     : {}\n", disc.sectors());
31
32    for track in disc.tracks() {
33        println!("Track #{}", track.number);
34        println!("    ISRC    : {}", track.isrc);
35        println!("    Offset  : {}", track.offset);
36        println!("    Sectors : {}", track.sectors);
37    }
38}
Source

pub fn get_track(&self, number: i32) -> Option<Track>

Returns information about a specific track on the disc.

This method retrieves a Track instance for the given track number, if it exists on the disc. If the requested track number is outside the valid range of first_track_num to last_track_num, None is returned.

§Parameters
  • number: The track number (1-99) you want to access.
§Returns
  • Some(Track) if the track exists.
  • None if the track number is out of bounds.
§Examples
use discid::DiscId;

let offsets = [242457, 150, 44942, 61305, 72755];
let disc = DiscId::put(1, &offsets).expect("DiscId::put() failed");

if let Some(track) = disc.get_track(3) {
    println!("Track #{} offset: {}", track.number, track.offset);
} else {
    println!("Track not found");
}
Source

pub fn nth_track(&self, number: i32) -> Track

Returns a Track instance for the nth track.

§Panics

Panics if number is outside the range given by first_track_num and last_track_num.

Consider using get_track for accessing tracks without the possibility of panicking.

§Examples
use discid::DiscId;

let offsets = [
   242457, 150, 44942, 61305, 72755, 96360, 130485, 147315, 164275, 190702, 205412, 220437,
];
let disc = DiscId::put(1, &offsets).expect("DiscId::put() failed");
let track = disc.nth_track(7);
assert_eq!(7, track.number);
assert_eq!(147315, track.offset);
assert_eq!(16960, track.sectors);

Trait Implementations§

Source§

impl Debug for DiscId

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for DiscId

§

impl RefUnwindSafe for DiscId

§

impl !Send for DiscId

§

impl !Sync for DiscId

§

impl Unpin for DiscId

§

impl UnwindSafe for DiscId

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.