mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Compare commits
5 Commits
2a15199505
...
b600628d77
Author | SHA1 | Date | |
---|---|---|---|
|
b600628d77 | ||
|
e9f1b5825a | ||
|
c9cf6bab92 | ||
|
084a3dd0f2 | ||
|
2166f257c8 |
@ -159,6 +159,7 @@ strip = true
|
|||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
blocks_in_conditions = "allow"
|
blocks_in_conditions = "allow"
|
||||||
comparison_chain = "allow"
|
comparison_chain = "allow"
|
||||||
|
iter_over_hash_type = "warn"
|
||||||
manual_range_contains = "allow"
|
manual_range_contains = "allow"
|
||||||
mutable_key_type = "allow"
|
mutable_key_type = "allow"
|
||||||
uninlined_format_args = "warn"
|
uninlined_format_args = "warn"
|
||||||
|
@ -139,6 +139,7 @@ impl Watcher {
|
|||||||
fn update(&mut self, iter: impl IntoIterator<Item = PathBuf>) -> StrResult<()> {
|
fn update(&mut self, iter: impl IntoIterator<Item = PathBuf>) -> StrResult<()> {
|
||||||
// Mark all files as not "seen" so that we may unwatch them if they
|
// Mark all files as not "seen" so that we may unwatch them if they
|
||||||
// aren't in the dependency list.
|
// aren't in the dependency list.
|
||||||
|
#[allow(clippy::iter_over_hash_type, reason = "order does not matter")]
|
||||||
for seen in self.watched.values_mut() {
|
for seen in self.watched.values_mut() {
|
||||||
*seen = false;
|
*seen = false;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,7 @@ impl SystemWorld {
|
|||||||
|
|
||||||
/// Reset the compilation state in preparation of a new compilation.
|
/// Reset the compilation state in preparation of a new compilation.
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
|
#[allow(clippy::iter_over_hash_type, reason = "order does not matter")]
|
||||||
for slot in self.slots.get_mut().values_mut() {
|
for slot in self.slots.get_mut().values_mut() {
|
||||||
slot.reset();
|
slot.reset();
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,16 @@ pub struct PackageInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PackageManifest {
|
impl PackageManifest {
|
||||||
|
/// Create a new package manifest with the given package info.
|
||||||
|
pub fn new(package: PackageInfo) -> Self {
|
||||||
|
PackageManifest {
|
||||||
|
package,
|
||||||
|
template: None,
|
||||||
|
tool: ToolInfo::default(),
|
||||||
|
unknown_fields: UnknownFields::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Ensure that this manifest is indeed for the specified package.
|
/// Ensure that this manifest is indeed for the specified package.
|
||||||
pub fn validate(&self, spec: &PackageSpec) -> Result<(), EcoString> {
|
pub fn validate(&self, spec: &PackageSpec) -> Result<(), EcoString> {
|
||||||
if self.package.name != spec.name {
|
if self.package.name != spec.name {
|
||||||
@ -173,6 +183,44 @@ impl PackageManifest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TemplateInfo {
|
||||||
|
/// Create a new template info with only required fields.
|
||||||
|
pub fn new(path: impl Into<EcoString>, entrypoint: impl Into<EcoString>) -> Self {
|
||||||
|
TemplateInfo {
|
||||||
|
path: path.into(),
|
||||||
|
entrypoint: entrypoint.into(),
|
||||||
|
thumbnail: None,
|
||||||
|
unknown_fields: UnknownFields::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PackageInfo {
|
||||||
|
/// Create a new package info with only required fields.
|
||||||
|
pub fn new(
|
||||||
|
name: impl Into<EcoString>,
|
||||||
|
version: PackageVersion,
|
||||||
|
entrypoint: impl Into<EcoString>,
|
||||||
|
) -> Self {
|
||||||
|
PackageInfo {
|
||||||
|
name: name.into(),
|
||||||
|
version,
|
||||||
|
entrypoint: entrypoint.into(),
|
||||||
|
authors: vec![],
|
||||||
|
categories: vec![],
|
||||||
|
compiler: None,
|
||||||
|
description: None,
|
||||||
|
disciplines: vec![],
|
||||||
|
exclude: vec![],
|
||||||
|
homepage: None,
|
||||||
|
keywords: vec![],
|
||||||
|
license: None,
|
||||||
|
repository: None,
|
||||||
|
unknown_fields: BTreeMap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Identifies a package.
|
/// Identifies a package.
|
||||||
#[derive(Clone, Eq, PartialEq, Hash)]
|
#[derive(Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct PackageSpec {
|
pub struct PackageSpec {
|
||||||
@ -535,22 +583,11 @@ mod tests {
|
|||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
Ok(PackageManifest {
|
Ok(PackageManifest {
|
||||||
package: PackageInfo {
|
package: PackageInfo::new(
|
||||||
name: "package".into(),
|
"package",
|
||||||
version: PackageVersion { major: 0, minor: 1, patch: 0 },
|
PackageVersion { major: 0, minor: 1, patch: 0 },
|
||||||
entrypoint: "src/lib.typ".into(),
|
"src/lib.typ"
|
||||||
authors: vec![],
|
),
|
||||||
license: None,
|
|
||||||
description: None,
|
|
||||||
homepage: None,
|
|
||||||
repository: None,
|
|
||||||
keywords: vec![],
|
|
||||||
categories: vec![],
|
|
||||||
disciplines: vec![],
|
|
||||||
compiler: None,
|
|
||||||
exclude: vec![],
|
|
||||||
unknown_fields: BTreeMap::new(),
|
|
||||||
},
|
|
||||||
template: None,
|
template: None,
|
||||||
tool: ToolInfo { sections: BTreeMap::new() },
|
tool: ToolInfo { sections: BTreeMap::new() },
|
||||||
unknown_fields: BTreeMap::new(),
|
unknown_fields: BTreeMap::new(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user