Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expand embedded_io::ErrorKind to better match std::io::ErrorKind #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
Oakchris1955 wants to merge 1 commit into rust-embedded:master
base: master
Choose a base branch
Loading
from Oakchris1955:expand_errorkind
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions embedded-io/src/lib.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,26 @@ pub enum ErrorKind {
OutOfMemory,
/// An attempted write could not write any data.
WriteZero,
/// The filesystem or storage medium is read-only,
/// but a write operation was attempted.
ReadOnlyFilesystem,
/// The underlying storage (typically, a filesystem) is full.
///
/// This does not include out of quota errors.
StorageFull,
/// Seek on unseekable file.
///
/// Seeking was attempted on an open file handle
/// which is not suitable for seeking
NotSeekable,
/// Filesystem quota or some other kind of quota was exceeded.
QuotaExceeded,
/// File larger than allowed or supported.
///
/// This might arise from a hard limit of the underlying filesystem or
/// file access API, or from an administratively imposed resource limitation.
/// Simple disk full, and out of quota, have their own errors.
FileTooLarge,
}

#[cfg(feature = "std")]
Expand All @@ -137,6 +157,11 @@ impl From<ErrorKind> for std::io::ErrorKind {
ErrorKind::Interrupted => std::io::ErrorKind::Interrupted,
ErrorKind::Unsupported => std::io::ErrorKind::Unsupported,
ErrorKind::OutOfMemory => std::io::ErrorKind::OutOfMemory,
ErrorKind::ReadOnlyFilesystem => std::io::ErrorKind::ReadOnlyFilesystem,
ErrorKind::StorageFull => std::io::ErrorKind::StorageFull,
ErrorKind::NotSeekable => std::io::ErrorKind::NotSeekable,
ErrorKind::QuotaExceeded => std::io::ErrorKind::QuotaExceeded,
ErrorKind::FileTooLarge => std::io::ErrorKind::FileTooLarge,
_ => std::io::ErrorKind::Other,
}
}
Expand All @@ -163,6 +188,11 @@ impl From<std::io::ErrorKind> for ErrorKind {
std::io::ErrorKind::Interrupted => ErrorKind::Interrupted,
std::io::ErrorKind::Unsupported => ErrorKind::Unsupported,
std::io::ErrorKind::OutOfMemory => ErrorKind::OutOfMemory,
std::io::ErrorKind::ReadOnlyFilesystem => ErrorKind::ReadOnlyFilesystem,
std::io::ErrorKind::StorageFull => ErrorKind::StorageFull,
std::io::ErrorKind::NotSeekable => ErrorKind::NotSeekable,
std::io::ErrorKind::QuotaExceeded => ErrorKind::QuotaExceeded,
std::io::ErrorKind::FileTooLarge => ErrorKind::FileTooLarge,
_ => ErrorKind::Other,
}
}
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /