mirror of
https://github.com/status-im/QR-Code-generator.git
synced 2025-02-23 18:08:20 +00:00
Added Rust documentation comments for Version and Mask struct+impl.
This commit is contained in:
parent
38d8d3377f
commit
d234e1c73b
@ -1220,30 +1220,40 @@ impl BitBuffer {
|
||||
|
||||
/*---- Miscellaneous values ----*/
|
||||
|
||||
/// A number between 1 and 40 (inclusive).
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Version(u8);
|
||||
|
||||
impl Version {
|
||||
/// Creates a version object from the given number.
|
||||
///
|
||||
/// Panics if the number is outside the range [1, 40].
|
||||
pub fn new(ver: u8) -> Self {
|
||||
assert!(QrCode_MIN_VERSION.value() <= ver && ver <= QrCode_MAX_VERSION.value(), "Version number out of range");
|
||||
Version(ver)
|
||||
}
|
||||
|
||||
/// Returns the value, which is in the range [1, 40].
|
||||
pub fn value(&self) -> u8 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// A number between 0 and 7 (inclusive).
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Mask(u8);
|
||||
|
||||
impl Mask {
|
||||
/// Creates a mask object from the given number.
|
||||
///
|
||||
/// Panics if the number is outside the range [0, 7].
|
||||
pub fn new(mask: u8) -> Self {
|
||||
assert!(mask <= 7, "Mask value out of range");
|
||||
Mask(mask)
|
||||
}
|
||||
|
||||
/// Returns the value, which is in the range [0, 7].
|
||||
pub fn value(&self) -> u8 {
|
||||
self.0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user