Skip to content

Instantly share code, notes, and snippets.

@berkes
Created October 4, 2022 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berkes/69d1b785d2e98ea05c912fd0e51ce8cb to your computer and use it in GitHub Desktop.
Save berkes/69d1b785d2e98ea05c912fd0e51ce8cb to your computer and use it in GitHub Desktop.
impl PageSize {
pub fn new_from_kilobytes(value: usize) -> Result<Self, DomainError> {
Ok(Self { value })
}
pub fn as_bytes(&self) -> usize {
&self.value / 1_000
}
pub fn as_kilobytes(&self) -> usize {
self.value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment