[−][src]Struct qrcode_generator::QrSegment
A segment of character/binary/control data in a QR Code symbol.
Instances of this struct are immutable.
The mid-level way to create a segment is to take the payload data
and call a static factory function such as QrSegment::make_numeric()
.
The low-level way to create a segment is to custom-make the bit buffer
and call the QrSegment::new()
constructor with appropriate values.
This segment struct imposes no length restrictions, but QR Codes have restrictions. Even in the most favorable conditions, a QR Code can only hold 7089 characters of data. Any segment longer than this is meaningless for the purpose of generating QR Codes.
Implementations
impl QrSegment
[src]
pub fn make_bytes(data: &[u8]) -> QrSegment
[src]
Returns a segment representing the given binary data encoded in byte mode.
All input byte slices are acceptable.
Any text string can be converted to UTF-8 bytes and encoded as a byte mode segment.
pub fn make_numeric(text: &[char]) -> QrSegment
[src]
Returns a segment representing the given string of decimal digits encoded in numeric mode.
Panics if the string contains non-digit characters.
pub fn make_alphanumeric(text: &[char]) -> QrSegment
[src]
Returns a segment representing the given text string encoded in alphanumeric mode.
The characters allowed are: 0 to 9, A to Z (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
Panics if the string contains non-encodable characters.
pub fn make_segments(text: &[char]) -> Vec<QrSegment>
[src]
Returns a list of zero or more segments to represent the given Unicode text string.
The result may use various segment modes and switch modes to optimize the length of the bit stream.
pub fn make_eci(assignval: u32) -> QrSegment
[src]
Returns a segment representing an Extended Channel Interpretation (ECI) designator with the given assignment value.
pub fn new(mode: QrSegmentMode, numchars: usize, data: Vec<bool>) -> QrSegment
[src]
Creates a new QR Code segment with the given attributes and data.
The character count (numchars) must agree with the mode and the bit buffer length, but the constraint isn't checked.
pub fn mode(&self) -> QrSegmentMode
[src]
Returns the mode indicator of this segment.
pub fn num_chars(&self) -> usize
[src]
Returns the character count field of this segment.
pub fn data(&self) -> &Vec<bool>
[src]
Returns the data bits of this segment.
Trait Implementations
impl Clone for QrSegment
[src]
impl Eq for QrSegment
[src]
impl PartialEq<QrSegment> for QrSegment
[src]
impl StructuralEq for QrSegment
[src]
impl StructuralPartialEq for QrSegment
[src]
Auto Trait Implementations
impl RefUnwindSafe for QrSegment
impl Send for QrSegment
impl Sync for QrSegment
impl Unpin for QrSegment
impl UnwindSafe for QrSegment
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,