Fix CI lints: samples referenced in every build, missing docs, rustdoc links, deprecated Ui::id, unused manifest dependencies

This commit is contained in:
aiongg
2026-11-16 03:03:33 +00:00
parent 016d5074c6
commit 0835e114ca
22 changed files with 63 additions and 51 deletions
+10
View File
@@ -35,7 +35,9 @@
use std::collections::{BTreeMap, HashMap};
/// The eight-byte magic number that opens a Bento container.
pub const MAGIC: [u8; 8] = [0xA4, b'C', b'M', 0xA5, b'H', b'd', b'r', 0xD7];
/// The size in bytes of one label in the container table.
pub const LABEL_SIZE: usize = 24;
// standard object ids
@@ -97,6 +99,7 @@ impl Default for Writer {
}
impl Writer {
/// An empty writer that assigns user object ids from the first free id.
pub fn new() -> Writer {
Writer { data: Vec::new(), names: HashMap::new(), next: MIN_USER_ID, entries: Vec::new() }
}
@@ -114,14 +117,17 @@ impl Writer {
id
}
/// The id of the global property named `name`, assigned on first use.
pub fn property(&mut self, name: &str) -> u32 {
self.named(GLOBAL_PROP_NAME, name)
}
/// The id of the global type named `name`, assigned on first use.
pub fn type_id(&mut self, name: &str) -> u32 {
self.named(GLOBAL_TYPE_NAME, name)
}
/// Allocates the next free user object id.
pub fn new_object(&mut self) -> u32 {
let id = self.next;
self.next += 1;
@@ -156,6 +162,7 @@ impl Writer {
self.entries.push((obj, OBJ_REFERENCES, TYPE_7BIT_ASCII, vec![seg]));
}
/// Finishes the container and returns its bytes.
pub fn finish(mut self) -> Vec<u8> {
let seed = self.next;
self.entries.push((TOC_OBJECT, TOC_SEED, TOC_TYPE, vec![Seg::Imm(seed.to_be_bytes().to_vec())]));
@@ -245,6 +252,7 @@ impl<'a> Container<'a> {
self.objects.keys().copied()
}
/// Opens `data` as a Bento container, or says why it is not one.
pub fn open(data: &'a [u8]) -> Result<Container<'a>, String> {
if !sniff(data) {
return Err("no Bento label at the end of the file".into());
@@ -362,11 +370,13 @@ impl<'a> Container<'a> {
Ok(out)
}
/// The id registered for `name`, if any.
pub fn id_of(&self, name: &str) -> Option<u32> {
self.by_name.get(name).copied()
}
#[allow(dead_code)]
/// The name registered for `id`, if any.
pub fn name_of(&self, id: u32) -> Option<&str> {
self.names.get(&id).map(String::as_str)
}
+2 -1
View File
@@ -17,7 +17,8 @@ fn the_picked_file_type_gives_a_bare_name_its_extension_and_a_typed_extension_wi
let two = [Filter::new("Photoshop", &["psd", "psb"]), Filter::new("PNG", &["png"])];
let only = [Filter::new("Swatches", &["aco"])];
// (path, opened with, filters, picked type, expected path)
let table: [(&str, Option<&str>, &[Filter], Option<usize>, &str); 8] = [
type Case<'a> = (&'a str, Option<&'a str>, &'a [Filter], Option<usize>, &'a str);
let table: [Case; 8] = [
("/s/Untitled", Some("Untitled.psd"), &two, Some(1), "/s/Untitled.png"),
("/s/Untitled.psd", Some("Untitled.psd"), &two, Some(1), "/s/Untitled.png"),
("/s/art.png", Some("art.psd"), &two, Some(0), "/s/art.png"),
+1 -1
View File
@@ -179,7 +179,7 @@ pub fn write(
Ok(out.into_inner())
}
/// Like [`write`], streaming the archive into `out`. A writer that fails (for example to cancel
/// Like [`fn@write`], streaming the archive into `out`. A writer that fails (for example to cancel
/// a long save) stops the write at the next member or buffer and the error is returned.
#[allow(clippy::too_many_arguments)]
pub fn write_to<W: Write + Seek>(
+1 -1
View File
@@ -19,7 +19,7 @@ pub use crate::model::write::Format;
pub struct Handle(pub u32);
/// The handles of the fixed objects every drawing has. Entities and table entries count up from
/// [`FIRST_FREE`].
/// `FIRST_FREE`.
pub mod fixed {
use super::Handle;
pub const LAYER_TABLE: Handle = Handle(0x1);
+2 -2
View File
@@ -40,9 +40,9 @@ pub fn write<T: Serialize>(workbook: &T) -> Result<Vec<u8>, Error> {
serde_json::to_vec_pretty(workbook).map_err(Error::Write)
}
/// [`write`], with `kept` appended to the top-level list `field` (made if absent): entries a
/// [`fn@write`], with `kept` appended to the top-level list `field` (made if absent): entries a
/// newer version wrote that this build kept without reading. With nothing kept this is exactly
/// [`write`]. Otherwise the workbook goes through a [`Value`] first, so its object keys are
/// [`fn@write`]. Otherwise the workbook goes through a [`Value`] first, so its object keys are
/// written in `serde_json`'s map order.
pub fn write_with_kept<T: Serialize>(workbook: &T, field: &str, kept: &[Value]) -> Result<Vec<u8>, Error> {
if kept.is_empty() {
+7 -7
View File
@@ -120,7 +120,7 @@ impl<B: AsRef<[u8]>> AsRef<[u8]> for SharedInput<B> {
/// A PNG decoded in resumable steps, for a caller that must not block for the whole image (the
/// web build, which has no threads): [`PngDecodeRows::step`] decodes rows until the caller says to
/// stop, and returns the [`Image`] once the last row and the chunks after it are read. [`decode`]
/// stop, and returns the `Image` once the last row and the chunks after it are read. `decode`
/// drives one to the end, so the two give the same image.
///
/// An interlaced (Adam7) PNG decodes in a single step: its passes land at stride positions all
@@ -158,7 +158,7 @@ pub struct PngDecodeRows<B: AsRef<[u8]>> {
}
impl<B: AsRef<[u8]>> PngDecodeRows<B> {
/// Reads the header and refuses what [`decode`] refuses before any pixel is decoded: sizes
/// Reads the header and refuses what `decode` refuses before any pixel is decoded: sizes
/// past `limits`, and a file too small for the image it declares.
pub fn new(bytes: B, limits: &Limits) -> Result<Self, CodecError> {
Self::open(bytes, limits, true, false)
@@ -385,11 +385,11 @@ impl<B: AsRef<[u8]>> PngDecodeRows<B> {
/// Decodes the rows of a [`streamable`](PngDecodeRows::streamable) file a group at a time:
/// `sink(y0, data)` gets whole rows `y0..` in final order, `group` of them at a time (the last
/// group may be shorter; 0 counts as 1), native-endian, exactly the samples [`decode`] would
/// group may be shorter; 0 counts as 1), native-endian, exactly the samples `decode` would
/// return, and the decoder keeps only that group. Decodes at least one row, then goes on while
/// `more()` returns true; `Some` with the extras once the file is read to its end, with the
/// resolution a format that lacks one takes from its EXIF or XMP. A damaged file fails with
/// the error [`decode`] gives, after however many rows were delivered. An orientation (an
/// the error `decode` gives, after however many rows were delivered. An orientation (an
/// `eXIf` after the image data may set one) is for the caller to apply. A new group size
/// must exceed any partial group retained from an earlier yield; otherwise this returns
/// an error without consuming another row.
@@ -724,7 +724,7 @@ pub(crate) fn has_additional_images(bytes: &[u8]) -> Result<bool, CodecError> {
Ok(info.animation_control.is_some_and(|a| u64::from(a.num_frames) + u64::from(info.frame_control.is_none()) > 1))
}
/// The size and pixel format the rows of [`decode_rows`] come in.
/// The size and pixel format the rows of `decode_rows` come in.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PngHeader {
pub width: u32,
@@ -733,7 +733,7 @@ pub struct PngHeader {
pub sample: SampleType,
}
/// Where [`decode_rows`] sends rows: the index of the first, then whole rows.
/// Where `decode_rows` sends rows: the index of the first, then whole rows.
pub type PngRowSink<'a, E> = dyn FnMut(u32, &[u8]) -> Result<(), E> + 'a;
/// Decodes a PNG a group of rows at a time, so the caller never needs the whole decoded image:
@@ -1362,7 +1362,7 @@ fn write_idat<W: Write>(writer: &mut png::Writer<W>, zlib: &[u8], max: usize) ->
/// A PNG encoded a band of rows at a time, for images too large to hold whole (a multi-gigapixel
/// print): each band is converted to the encode plan, filtered and deflated on all cores as it
/// arrives and written as IDAT chunks, so only about one band is ever held. The deflate bands are
/// [`parallel_idat`]'s, so the zlib stream is the one [`crate::encode`] writes for a large image.
/// `parallel_idat`'s, so the zlib stream is the one `crate::encode` writes for a large image.
/// Never interlaced (Adam7 needs the whole image).
pub struct PngRows<W: Write> {
writer: png::Writer<W>,
@@ -85,7 +85,7 @@ const GROUP_BYTES: usize = 64 << 20;
/// A TIFF page opened for decoding a group of bands at a time, for images too large to hold
/// twice (#8169): [`TiffBands::decode`] hands each group to its caller, who writes it into the
/// document, so only one group exists beside the document. The pixels, layout and metadata are
/// those [`decode_page`] returns; [`TiffBands::upright`] applies the orientation as
/// those `decode_page` returns; `TiffBands::upright` applies the orientation as
/// [`Image::oriented`] does.
pub struct TiffBands<'a> {
b: &'a [u8],
@@ -103,7 +103,7 @@ pub struct TiffBands<'a> {
}
impl<'a> TiffBands<'a> {
/// Opens page `page` (`None`: the page [`decode_page`] opens by default) and checks it
/// Opens page `page` (`None`: the page `decode_page` opens by default) and checks it
/// against `limits`; on 64-bit targets its `max_alloc` bounds each group of bands, not the
/// whole image.
pub fn open(bytes: &'a [u8], page: Option<usize>, limits: &Limits) -> Result<Self, CodecError> {
+1 -1
View File
@@ -10,7 +10,7 @@ pub(super) const TAG_PHOTOSHOP: u16 = 34377;
/// Photoshop `ImageSourceData`: the layers of a layered TIFF.
pub(super) const TAG_IMAGE_SOURCE_DATA: u16 = 37724;
/// `true` when [`encode`] writes little-endian (`II`) files: the `tiff` encoder writes the
/// `true` when `encode` writes little-endian (`II`) files: the `tiff` encoder writes the
/// running target's byte order, and every target PhotoCraft builds for is little-endian.
/// Byte-order-sensitive payloads (Photoshop layer data) must be produced to match.
pub fn writes_little_endian() -> bool {
@@ -1,6 +1,6 @@
//! X11 color-name database (X.Org rgb.txt) normalized to lowercase without
//! spaces, underscores, or hyphens. RGB values are *X11* values, not CSS values.
//! Source: https://cgit.freedesktop.org/xorg/app/rgb/tree/rgb.txt
//! Source: <https://cgit.freedesktop.org/xorg/app/rgb/tree/rgb.txt>
//! License: MIT (X.Org Foundation), see the upstream app/rgb COPYING file.
//! Aliases differing only in case or spaces have been collapsed.
//! Keep sorted: decoder uses binary search without allocation per candidate.
+1 -1
View File
@@ -179,7 +179,7 @@ impl OrientSteps {
if self.oh == 0 { 1.0 } else { self.done as f32 / self.oh as f32 }
}
/// Writes bands of [`BAND`] output rows, at least one, then goes on while `more()` returns
/// Writes bands of `BAND` output rows, at least one, then goes on while `more()` returns
/// true; `Some` with the upright image once the last band is written.
pub fn step(&mut self, more: &mut dyn FnMut() -> bool) -> Result<Option<Image>, CodecError> {
if !(2..=8).contains(&self.o) {
+3
View File
@@ -14,8 +14,11 @@ const TIP_HEADER: usize = 6 + 1 + 4 + 4;
/// Decoded grayscale samples. Eight-bit samples expand losslessly by multiplication by 257.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Tip {
/// Width in pixels.
pub width: u32,
/// Height in pixels.
pub height: u32,
/// Row-major grayscale samples, `width * height` of them.
pub data: Vec<u16>,
}
+19 -19
View File
@@ -612,7 +612,7 @@ fn is_date_time(text: &str) -> bool {
}
/// Whether [`Imap::uid_search_header`] can look for `text`: printable ASCII, at most
/// [`MAX_QUOTED`] bytes. What it can't be asked for, it refuses unsent.
/// `MAX_QUOTED` bytes. What it can't be asked for, it refuses unsent.
pub fn searchable(text: &str) -> bool {
!text.is_empty() && text.len() <= MAX_QUOTED && text.bytes().all(|b| matches!(b, b' '..=b'~'))
}
@@ -812,7 +812,7 @@ impl<S: Read + Write> Imap<S> {
}
/// [`list`](Self::list), and how many more mailboxes the server listed that were read and
/// dropped because the list was full ([`MAX_MAILBOXES`], [`MAX_LIST_BYTES`]): 0 when it
/// dropped because the list was full (`MAX_MAILBOXES`, `MAX_LIST_BYTES`): 0 when it
/// was kept whole.
pub fn list_counted(&mut self) -> Result<(Vec<Mailbox>, usize), ProtoError> {
let mut out: Vec<Mailbox> = Vec::new();
@@ -857,7 +857,7 @@ impl<S: Read + Write> Imap<S> {
Ok(self.selected.clone())
}
/// UID FETCH <set> (UID FLAGS): every message in the set with its flags. `set` like "1:*" or "5,9,12:20".
/// UID FETCH `<set>` (UID FLAGS): every message in the set with its flags. `set` like "1:*" or "5,9,12:20".
///
/// The messages come back in UID order, each once.
pub fn uid_fetch_flags(&mut self, set: &str) -> Result<Vec<Fetched>, ProtoError> {
@@ -868,7 +868,7 @@ impl<S: Read + Write> Imap<S> {
/// well (`UID FETCH <set> (UID FLAGS X-GM-MSGID X-GM-LABELS)`, in [`Fetched::gmail_id`] and
/// [`Fetched::gmail_labels`]): for Gmail's server alone, which documents them among its IMAP
/// extensions. A message it gives no id, or one that isn't a number, has none; one it gives
/// no labels has `None` there, and one past [`MAX_GMAIL_LABEL_BYTES`] of labels in the fetch
/// no labels has `None` there, and one past `MAX_GMAIL_LABEL_BYTES` of labels in the fetch
/// too.
pub fn uid_fetch_flags_gmail(&mut self, set: &str) -> Result<Vec<Fetched>, ProtoError> {
self.fetch_flags(set, true, true)
@@ -944,7 +944,7 @@ impl<S: Read + Write> Imap<S> {
.collect())
}
/// UID FETCH <set> (UID RFC822.SIZE): the size in bytes of every message in the set, in UID order.
/// UID FETCH `<set>` (UID RFC822.SIZE): the size in bytes of every message in the set, in UID order.
pub fn uid_fetch_sizes(&mut self, set: &str) -> Result<Vec<(u32, u64)>, ProtoError> {
let mut out: Vec<(u32, u64)> = Vec::new();
let command = Self::fetch(set, "(UID RFC822.SIZE)")?;
@@ -966,12 +966,12 @@ impl<S: Read + Write> Imap<S> {
Ok(out)
}
/// UID FETCH <uid> (UID FLAGS INTERNALDATE BODY.PEEK[]); `None` when the UID is gone.
/// UID FETCH `<uid>` (UID FLAGS INTERNALDATE BODY.PEEK[]); `None` when the UID is gone.
pub fn uid_fetch_message(&mut self, uid: u32) -> Result<Option<Fetched>, ProtoError> {
self.fetch_one(uid, "(UID FLAGS INTERNALDATE BODY.PEEK[])", false)
}
/// UID FETCH <uid> (UID FLAGS INTERNALDATE BODY.PEEK[HEADER]): the header alone of a message
/// UID FETCH `<uid>` (UID FLAGS INTERNALDATE `BODY.PEEK[HEADER]`): the header alone of a message
/// that is not taken whole (one that is too large), in [`Fetched::body`], up to and with the
/// empty line that ends it. `None` when the UID is gone.
pub fn uid_fetch_header(&mut self, uid: u32) -> Result<Option<Fetched>, ProtoError> {
@@ -1003,7 +1003,7 @@ impl<S: Read + Write> Imap<S> {
Ok(found.filter(|message| message.body.is_some()))
}
/// UID STORE <uid> +FLAGS.SILENT / -FLAGS.SILENT (flags).
/// UID STORE `<uid>` +FLAGS.SILENT / -FLAGS.SILENT (flags).
pub fn uid_store(&mut self, uid: u32, add: bool, flags: &[&str]) -> Result<(), ProtoError> {
let flags = flag_list(flags)?;
if uid == 0 {
@@ -1012,7 +1012,7 @@ impl<S: Read + Write> Imap<S> {
self.store(&uid.to_string(), add, &flags)
}
/// UID STORE <set> +FLAGS.SILENT / -FLAGS.SILENT (flags): the same change for every message
/// UID STORE `<set>` +FLAGS.SILENT / -FLAGS.SILENT (flags): the same change for every message
/// the set names (number by number, as [`uid_sets`] writes it; `1:*` is refused). A UID that
/// is no longer there is passed over by the server without a word.
pub fn uid_store_set(&mut self, set: &str, add: bool, flags: &[&str]) -> Result<(), ProtoError> {
@@ -1020,9 +1020,9 @@ impl<S: Read + Write> Imap<S> {
self.store(named(set)?, add, &flags)
}
/// UID SEARCH UNDELETED HEADER <field> <text>: the messages of the open mailbox, other than
/// UID SEARCH UNDELETED HEADER `<field>` `<text>`: the messages of the open mailbox, other than
/// those marked as deleted, whose header field `field` has `text` in it (the server matches a
/// part of the field, whatever its case), by UID in UID order, at most [`MAX_FOUND`] of them.
/// part of the field, whatever its case), by UID in UID order, at most `MAX_FOUND` of them.
/// `field` is a field's name, and `text` one that [`searchable`] lets through: anything else
/// is refused unsent.
pub fn uid_search_header(&mut self, field: &str, text: &str) -> Result<Vec<u32>, ProtoError> {
@@ -1048,15 +1048,15 @@ impl<S: Read + Write> Imap<S> {
Ok(found.into_iter().collect())
}
/// UID SEARCH UID <set> UNDELETED X-GM-RAW "<query>": the messages of the open mailbox, among
/// UID SEARCH UID `<set>` UNDELETED X-GM-RAW "`<query>`": the messages of the open mailbox, among
/// those `set` names and not marked as deleted, that Gmail's own search finds for `query`
/// (`category:social`), by UID in UID order. `X-GM-RAW` is Gmail's (Google's "Gmail IMAP extensions"): for Gmail's server alone.
///
/// The query goes in quotes, without the CR, LF and NUL that could end the command early; one
/// that is empty then, or isn't printable ASCII within [`MAX_QUOTED`] bytes, is refused unsent.
/// that is empty then, or isn't printable ASCII within `MAX_QUOTED` bytes, is refused unsent.
/// Of the answer, only UIDs inside `set` are taken, at most [`MAX_GMAIL_FOUND`] of them: a
/// caller that wants them all asks for sets of fewer messages than that. An answer longer than
/// [`MAX_LINE`](crate::MAX_LINE) is read past and refused ([`ProtoError::Rejected`]): the
/// [`MAX_LINE`] is read past and refused ([`ProtoError::Rejected`]): the
/// session goes on.
pub fn uid_search_gmail(&mut self, set: &str, query: &str) -> Result<Vec<u32>, ProtoError> {
if !is_set(set) {
@@ -1101,14 +1101,14 @@ impl<S: Read + Write> Imap<S> {
self.run(command, &mut ignore).map(|_| ())
}
/// UID MOVE <set> <mailbox> (RFC 6851, for a server that offers `MOVE`): the messages leave
/// UID MOVE `<set>` `<mailbox>` (RFC 6851, for a server that offers `MOVE`): the messages leave
/// the open mailbox for the named one in one step. Answers where they are now when the
/// server says so beyond doubt (`COPYUID`), `None` otherwise.
pub fn uid_move(&mut self, set: &str, raw_name: &str) -> Result<Option<Copied>, ProtoError> {
self.transfer("UID MOVE", set, raw_name)
}
/// UID COPY <set> <mailbox>: copies of the messages are added to the named mailbox. Answers
/// UID COPY `<set>` `<mailbox>`: copies of the messages are added to the named mailbox. Answers
/// like [`uid_move`](Self::uid_move).
pub fn uid_copy(&mut self, set: &str, raw_name: &str) -> Result<Option<Copied>, ProtoError> {
self.transfer("UID COPY", set, raw_name)
@@ -1126,7 +1126,7 @@ impl<S: Read + Write> Imap<S> {
done.map(|_| copied)
}
/// UID EXPUNGE <set> (RFC 4315): the messages of the set that are marked `\Deleted` go for
/// UID EXPUNGE `<set>` (RFC 4315): the messages of the set that are marked `\Deleted` go for
/// good, and no others. Refused unsent unless the server has said `UIDPLUS`: a server
/// without it only knows the EXPUNGE that takes every marked message of the mailbox.
pub fn uid_expunge(&mut self, set: &str) -> Result<(), ProtoError> {
@@ -1137,13 +1137,13 @@ impl<S: Read + Write> Imap<S> {
self.run(Command::new("UID EXPUNGE").arg(set), &mut ignore).map(|_| ())
}
/// CREATE <mailbox>. `raw_name` is the name as the server wants it: in modified UTF-7
/// CREATE `<mailbox>`. `raw_name` is the name as the server wants it: in modified UTF-7
/// ([`encode_utf7`]), its levels joined with the server's own delimiter.
pub fn create(&mut self, raw_name: &str) -> Result<(), ProtoError> {
self.run(Command::new("CREATE").string(raw_name.as_bytes()), &mut ignore).map(|_| ())
}
/// SUBSCRIBE <mailbox>: other mail programs list subscribed mailboxes only.
/// SUBSCRIBE `<mailbox>`: other mail programs list subscribed mailboxes only.
pub fn subscribe(&mut self, raw_name: &str) -> Result<(), ProtoError> {
self.run(Command::new("SUBSCRIBE").string(raw_name.as_bytes()), &mut ignore).map(|_| ())
}
+1 -1
View File
@@ -1,6 +1,6 @@
//! PostScript and EPS for the Craft apps.
//!
//! - [`read`] (feature `read`): runs an EPS and gives what it paints as a one-page vector PDF,
//! - `read` (feature `read`): runs an EPS and gives what it paints as a one-page vector PDF,
//! for apps that place EPS files as graphics.
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
#![forbid(unsafe_code)]
+1 -1
View File
@@ -269,7 +269,7 @@ impl DigitalSignature {
}
/// `text` (a name or address from a certificate) as a name coming in is kept
/// ([`crate::names::incoming`]): one line, without control or format characters (no
/// (`crate::names::incoming`): one line, without control or format characters (no
/// reordering by a bidirectional override, nothing hidden by a zero-width one), at most
/// [`MAX_SIGNER_TEXT`] characters.
pub fn signer_text(text: &str) -> String {
+1 -1
View File
@@ -28,7 +28,7 @@ pub struct CertificateInfo {
pub addresses: Vec<String>,
/// Until when it is valid.
pub not_after: Timestamp,
/// Whether it is for mail ([`Cert::for_mail`]).
/// Whether it is for mail (`Cert::for_mail`).
pub for_mail: bool,
/// Whether it is a certification authority's.
pub authority: bool,
+2 -2
View File
@@ -13,7 +13,7 @@ workspace = true
[dependencies]
craft-xml = { workspace = true }
quick-xml = { version = "0.41", default-features = false }
craft-image-codecs = { workspace = true }
craft-image-codecs = { workspace = true, optional = true }
# SVGZ (gzip), pure-Rust backend.
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
kurbo = { workspace = true }
@@ -32,7 +32,7 @@ data-url = { version = "0.3.2", optional = true }
[features]
# `craft_svg::tree`: usvg behind the bounded entry point.
tree = ["dep:usvg", "dep:data-url"]
tree = ["dep:usvg", "dep:data-url", "dep:craft-image-codecs"]
# Text converted to paths (needs a font database in the options).
tree-text = ["tree", "usvg/text"]
# The system's fonts in `usvg::fontdb`.
+1 -1
View File
@@ -473,7 +473,7 @@ impl Scene for CanvasViewScene {
// The scene's motion: a pan every frame, as a user's drag would make.
pan(view, vec2(3.0, 2.0));
let text = RulerText::new(RulerUnits::pixels(), UnitKind::Pixels);
let canvas = ui.id().with("canvas scene");
let canvas = ui.scope_id().with("canvas scene");
let shown = Canvas::new("Document").id(canvas).view(*view).rulers(text, text, *zero).show_rulers(true).show(ui, |ui, body| {
let _ = RasterDisplay::new("Picture", &SOURCE).show_at(ui, body.rect);
let _ = Guides::new("Guides", canvas, Bind::bound(&mut *guides)).show_at(ui, body.rect);
+1 -4
View File
@@ -461,8 +461,5 @@ macro_rules! __register_pattern {
#[macro_export]
#[cfg(not(feature = "testing"))]
macro_rules! __register_contract {
($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [$($sample:path)?], $purpose:expr) => {
// Keeps the sample referenced, so it is never dead code when `testing` is off.
$(const _: () = { let _ = $sample; };)?
};
($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [$($sample:path)?], $purpose:expr) => {};
}
+2
View File
@@ -219,6 +219,8 @@ fn registrations(k: &TokenStream, types: &[Type], declared: &Declared, shape: Sh
let each = types.iter().map(|ty| quote!(#k::__register_contract!(#ty, #shape, #overlay, [#(#exempt),*], [#(#sample)*], #purpose);));
let gate = registration_gate();
Ok(quote! {
// Outside the gate: the sample exists in every build, so it is never dead code where the registration is absent.
#(const _: () = { let _ = #sample; };)*
#gate
const _: () = {
#(#each)*
-1
View File
@@ -34,7 +34,6 @@ image = { version = "0.25", default-features = false, features = ["png"], option
serde = { workspace = true }
serde_json = { workspace = true }
log = "0.4"
getrandom = "0.3"
tempfile = "3"
sha2 = "0.10"
ureq = { version = "3.4", default-features = false, features = ["rustls-no-provider", "_ring", "gzip", "platform-verifier"] }
+3 -3
View File
@@ -16,7 +16,7 @@ workspace = true
[features]
# Every codec feature turns on one codec module; none is on by default.
# DNxHD / DNxHR (SMPTE ST 2019-1): decoder and encoder.
dnx = []
dnx = ["dep:craft-media"]
# APV (Advanced Professional Video, RFC 9924): decoder and encoder; `apv-decode` or `apv-encode` for one of them.
apv = ["apv-decode", "apv-encode"]
apv-decode = ["craft-media/bitstream"]
@@ -52,7 +52,7 @@ vp9-decode = ["craft-media/bitstream"]
vp9-encode = ["craft-media/isobmff"]
# AV1: decoder and encoder; `av1-decode` or `av1-encode` for one of them.
av1 = ["av1-decode", "av1-encode"]
av1-decode = []
av1-decode = ["dep:craft-media"]
av1-encode = ["craft-media/isobmff"]
# Tiled AV1 fallback for frames that exceed the clean-room encoder's single-tile limits.
av1-large-encode = ["av1-encode", "dep:rav1e"]
@@ -60,7 +60,7 @@ av1-large-encode = ["av1-encode", "dep:rav1e"]
threads = ["dep:rayon"]
[dependencies]
craft-media = { workspace = true }
craft-media = { workspace = true, optional = true }
thiserror = { workspace = true }
rayon = { workspace = true, optional = true }
+1 -1
View File
@@ -1,6 +1,6 @@
//! Animated WebP writing: the `VP8X`, `ANIM` and `ANMF` chunks around frames another encoder
//! made ([`animation`]), and, with feature `vp8`, whole lossy animations from RGBA frames through
//! `craft-video`'s VP8 encoder ([`lossy_animation`]).
//! `craft-video`'s VP8 encoder (`lossy_animation`).
use crate::{Error, MAX_CANVAS, MAX_VP8_DIMENSION, chunk};