Made error construction methods pub(crate)

This commit is contained in:
Josh Mitchell
2020-11-07 23:34:21 +11:00
parent 55fa21d45c
commit 4ca96364b9

View File

@@ -31,42 +31,42 @@ impl Error {
self.code.as_ref().map_or(false, ErrorCode::is_eof) self.code.as_ref().map_or(false, ErrorCode::is_eof)
} }
pub fn from_convert() -> Self { pub(crate) fn from_convert() -> Self {
Self { Self {
code: None, code: None,
task: ErrorTask::ToCString(None), task: ErrorTask::ToCString(None),
} }
} }
pub fn from_open(path: impl AsRef<Path>, mode: FileMode) -> Self { pub(crate) fn from_open(path: impl AsRef<Path>, mode: FileMode) -> Self {
Self { Self {
code: None, code: None,
task: ErrorTask::OpenFile(path.as_ref().into(), mode), task: ErrorTask::OpenFile(path.as_ref().into(), mode),
} }
} }
pub fn from_read_num_atoms(code: impl Into<ErrorCode>) -> Self { pub(crate) fn from_read_num_atoms(code: impl Into<ErrorCode>) -> Self {
Self { Self {
code: Some(code.into()), code: Some(code.into()),
task: ErrorTask::ReadNumAtoms, task: ErrorTask::ReadNumAtoms,
} }
} }
pub fn from_read(code: impl Into<ErrorCode>) -> Self { pub(crate) fn from_read(code: impl Into<ErrorCode>) -> Self {
Self { Self {
code: Some(code.into()), code: Some(code.into()),
task: ErrorTask::Read, task: ErrorTask::Read,
} }
} }
pub fn from_write(code: impl Into<ErrorCode>) -> Self { pub(crate) fn from_write(code: impl Into<ErrorCode>) -> Self {
Self { Self {
code: Some(code.into()), code: Some(code.into()),
task: ErrorTask::Write, task: ErrorTask::Write,
} }
} }
pub fn from_flush(code: impl Into<ErrorCode>) -> Self { pub(crate) fn from_flush(code: impl Into<ErrorCode>) -> Self {
Self { Self {
code: Some(code.into()), code: Some(code.into()),
task: ErrorTask::Flush, task: ErrorTask::Flush,