-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break serializers into common and platform-specific
- Loading branch information
Showing
5 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Functions used by Serde to serialize types that we don't own (and thus can't implement | ||
//! [Serialize] for) | ||
use {crate::serializers::*, serde::Serializer}; | ||
|
||
/// Serialize [goblin::error::Error] | ||
pub fn serialize_goblin_error<S: Serializer>( | ||
error: &goblin::error::Error, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> { | ||
serialize_generic_error(error, serializer) | ||
} | ||
/// Serialize [nix::Error] | ||
pub fn serialize_nix_error<S: Serializer>( | ||
error: &nix::Error, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> { | ||
serialize_generic_error(error, serializer) | ||
} | ||
/// Serialize [procfs_core::ProcError] | ||
pub fn serialize_proc_error<S: Serializer>( | ||
error: &procfs_core::ProcError, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> { | ||
serialize_generic_error(error, serializer) | ||
} | ||
/// Serialize [std::string::FromUtf8Error] | ||
pub fn serialize_from_utf8_error<S: Serializer>( | ||
error: &std::string::FromUtf8Error, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> { | ||
serialize_generic_error(error, serializer) | ||
} | ||
/// Serialize [std::time::SystemTimeError] | ||
pub fn serialize_system_time_error<S: Serializer>( | ||
error: &std::time::SystemTimeError, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> { | ||
serialize_generic_error(error, serializer) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters