Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }

Implementations§

Source§

impl Config

Source

pub fn new(model: Model, serial: String, media: Media) -> Config

Initialize configuration data with default values.

This method receives model and media. They are not modifiable after the initialization.

§Example
use ptouch::{Config, ContinuousType, Media, Model};
 
let media = Media::Continuous(ContinuousType::Continuous29);
let model = Model::QL800;
let config = Config::new(model, "serial".to_string(), media);
Source

pub fn enable_auto_cut(self, size: u8) -> Self

Enable auto cut after printing specified number of labels.

§Arguments
  • size - Number of labels to print before auto-cutting (1-255)
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .enable_auto_cut(3); // Cut after every 3 labels
Source

pub fn disable_auto_cut(self) -> Self

Disable automatic cutting of labels.

When disabled, labels will need to be manually torn or cut.

§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .disable_auto_cut();
Source

pub fn cut_at_end(self, flag: bool) -> Self

Control whether to cut the tape at the end of a print job.

§Arguments
  • flag - true to cut at end, false to leave uncut
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .cut_at_end(true); // Cut at the end of job
Source

pub fn high_resolution(self, high: bool) -> Self

Enable or disable high resolution printing.

High resolution doubles the vertical resolution from 300 DPI to 600 DPI. When enabled, image height should be doubled accordingly.

§Arguments
  • high - true for 600 DPI, false for 300 DPI
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .high_resolution(true); // Enable 600 DPI
Source

pub fn set_feed_in_dots(self, feed: u16) -> Self

Set the feeding length in dots.

Controls how much tape is fed before printing starts. Different media types have different valid ranges.

§Arguments
  • feed - Feed length in dots
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .set_feed_in_dots(150); // Set feed to 150 dots
Source

pub fn two_colors(self, two_colors: bool) -> Self

Enable or disable two-color printing (black and red).

Only supported on QL-820NWB with compatible red/black tape. When enabled, use print_two_color() method instead of print().

§Arguments
  • two_colors - true to enable two-color printing
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62Red))
    .two_colors(true); // Enable red and black printing
Source

pub fn compress(self, flag: bool) -> Self

Enable or disable data compression.

Uses PackBits compression to reduce USB transfer size. Automatically disabled for QL-800 model due to hardware limitations.

§Arguments
  • flag - true to enable compression
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(), 
                        Media::Continuous(ContinuousType::Continuous62))
    .compress(true); // Enable compression

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.