-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29b77a1
commit a898ce4
Showing
205 changed files
with
1,749 additions
and
139 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,41 @@ | ||
use rkyv::{ | ||
rancor::{Fallible, Source}, | ||
ser::Writer, | ||
string::{ArchivedString, StringResolver}, | ||
with::{ArchiveWith, DeserializeWith, SerializeWith}, | ||
Place, | ||
}; | ||
use smol_str::SmolStr; | ||
|
||
use super::AsPreset; | ||
|
||
impl ArchiveWith<SmolStr> for AsPreset { | ||
type Archived = ArchivedString; | ||
type Resolver = StringResolver; | ||
|
||
#[inline] | ||
fn resolve_with(field: &SmolStr, resolver: Self::Resolver, out: Place<Self::Archived>) { | ||
ArchivedString::resolve_from_str(field.as_str(), resolver, out); | ||
} | ||
} | ||
|
||
impl<S> SerializeWith<SmolStr, S> for AsPreset | ||
where | ||
S: ?Sized + Fallible + Writer, | ||
S::Error: Source, | ||
{ | ||
#[inline] | ||
fn serialize_with(field: &SmolStr, serializer: &mut S) -> Result<Self::Resolver, S::Error> { | ||
ArchivedString::serialize_from_str(field.as_str(), serializer) | ||
} | ||
} | ||
|
||
impl<D> DeserializeWith<ArchivedString, SmolStr, D> for AsPreset | ||
where | ||
D: ?Sized + Fallible, | ||
{ | ||
#[inline] | ||
fn deserialize_with(field: &ArchivedString, _: &mut D) -> Result<SmolStr, D::Error> { | ||
Ok(SmolStr::from(field.as_str())) | ||
} | ||
} |
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
Oops, something went wrong.