mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 04:27:49 +00:00
wasm: gate craft-print cancel token and craft-font-manager store imports off wasm32
On wasm32 the spooler-only `Cancel` internals (SENDING, CANCELLED_MESSAGE, start_sending) and the SuiteStore imports (Arc, Catalog) were never used. They follow the same cfg as their users, so the wasm check has no dead-code or unused-import warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
93bc1d8fbb
commit
6eb08ef180
@@ -6,10 +6,12 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Condvar, Mutex};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use craft_font_catalog::Catalog;
|
||||
pub use craft_font_store::UserSource;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
@@ -865,7 +865,9 @@ pub struct Cancel(std::sync::Arc<std::sync::atomic::AtomicU8>);
|
||||
|
||||
const PENDING: u8 = 0;
|
||||
const CANCELLED: u8 = 1;
|
||||
#[cfg(any(test, windows, all(unix, not(target_arch = "wasm32"))))]
|
||||
const SENDING: u8 = 2;
|
||||
#[cfg(any(test, windows, all(unix, not(target_arch = "wasm32"))))]
|
||||
const CANCELLED_MESSAGE: &str = "the print job was cancelled before anything was sent to the printer";
|
||||
|
||||
impl Cancel {
|
||||
@@ -887,6 +889,7 @@ impl Cancel {
|
||||
|
||||
/// The last point before anything reaches the spooler: the job is being sent from here on,
|
||||
/// unless it was cancelled.
|
||||
#[cfg(any(test, windows, all(unix, not(target_arch = "wasm32"))))]
|
||||
pub(crate) fn start_sending(&self) -> Result<(), Error> {
|
||||
use std::sync::atomic::Ordering::{AcqRel, Acquire};
|
||||
match self.0.compare_exchange(PENDING, SENDING, AcqRel, Acquire) {
|
||||
|
||||
Reference in New Issue
Block a user