Skip to content

Add documentation for MemorySize #13

@funnyboy-roks

Description

@funnyboy-roks

Add documentation to the methods generated for the MemorySize methods generated here:

leucite/src/prlimit.rs

Lines 9 to 33 in 72e36c4

macro_rules! impl_memsz {
($from_fn: ident => $param: ident * $expr: expr) => {
#[inline]
pub fn $from_fn($param: u64) -> Self {
Self($param * $expr)
}
#[inline]
pub fn $param(self) -> u64 {
self.0 / $expr
}
};
}
impl MemorySize {
impl_memsz!(from_bytes => bytes * 1);
impl_memsz!(from_kb => kilobytes * 1000);
impl_memsz!(from_mb => megabytes * 1000 * 1000);
impl_memsz!(from_gb => gigabytes * 1000 * 1000 * 1000);
impl_memsz!(from_kib => kibibytes * 1024);
impl_memsz!(from_mib => mebibytes * 1024 * 1024);
impl_memsz!(from_gib => gibibytes * 1024 * 1024 * 1024);
}

The documentation should specifically cover the math used (1024 vs 1000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions