October 2019
Intermediate to advanced
444 pages
10h 37m
English
Let's create an error wrapper in a few steps:
use std::fmt;use std::io;use std::error::Error;
#[derive(Debug)]pub struct InvalidDeviceIdError(usize);#[derive(Debug)]pub struct DeviceNotPresentError(usize);#[derive(Debug)]pub struct UnexpectedDeviceStateError {}
#[derive(Debug)]pub enum ErrorWrapper { Io(io::Error), Db(InvalidDeviceIdError), Device(DeviceNotPresentError), ...Read now
Unlock full access