forked from 1b-agent/fieldcraft-upstream
build(deps): adapt 3MF reader to quick-xml 0.42
This commit is contained in:
1 parent
f220c7108b
commit
e3d42d8be1
4 files changed
+29
-19
No files matched your search
Generated
+12
-3
@@ -1355,7 +1355,7 @@ name = "fieldcraft-geometry"
|
|||||||
version = "0.5.9"
|
version = "0.5.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fieldcraft-model",
|
"fieldcraft-model",
|
||||||
"quick-xml",
|
"quick-xml 0.42.0",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"solidcraft-doc",
|
"solidcraft-doc",
|
||||||
"solidcraft-engine",
|
"solidcraft-engine",
|
||||||
@@ -3087,6 +3087,15 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-xml"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.47"
|
version = "1.0.47"
|
||||||
@@ -3837,7 +3846,7 @@ name = "solidcraft-io"
|
|||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
source = "git+https://github.com/bherbruck/solidcraft?rev=b1695873f5d0031f51a8d5e7ec036fced6f000e2#b1695873f5d0031f51a8d5e7ec036fced6f000e2"
|
source = "git+https://github.com/bherbruck/solidcraft?rev=b1695873f5d0031f51a8d5e7ec036fced6f000e2#b1695873f5d0031f51a8d5e7ec036fced6f000e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quick-xml",
|
"quick-xml 0.41.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.9",
|
"sha2 0.10.9",
|
||||||
@@ -4698,7 +4707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"
|
checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quick-xml",
|
"quick-xml 0.41.0",
|
||||||
"quote",
|
"quote",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -35,9 +35,9 @@ serde = { version = "1", features = ["derive"] }
|
|||||||
serde_json = { version = "1", features = ["float_roundtrip"] }
|
serde_json = { version = "1", features = ["float_roundtrip"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
# 3MF packages (docs/formats/tagged-mesh.md): the same versions SolidCraft uses.
|
# 3MF packages (docs/formats/tagged-mesh.md).
|
||||||
zip = { version = "3", default-features = false, features = ["deflate"] }
|
zip = { version = "3", default-features = false, features = ["deflate"] }
|
||||||
quick-xml = "0.41"
|
quick-xml = "0.42"
|
||||||
|
|
||||||
# content hashes and part checksums of .fieldcraft files (the version SolidCraft uses)
|
# content hashes and part checksums of .fieldcraft files (the version SolidCraft uses)
|
||||||
sha2 = "0.11"
|
sha2 = "0.11"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Third-party software in FieldCraft
|
Third-party software in FieldCraft
|
||||||
|
|
||||||
FieldCraft (the desktop app, fieldcraft-cli and the web app) is built from the 477 crates below.
|
FieldCraft (the desktop app, fieldcraft-cli and the web app) is built from the 478 crates below.
|
||||||
Generated by `cargo xtask licences` from Cargo.lock and the crates' own licence files.
|
Generated by `cargo xtask licences` from Cargo.lock and the crates' own licence files.
|
||||||
FieldCraft's own licence is in LICENSE-MIT and LICENSE-APACHE, and NOTICE.
|
FieldCraft's own licence is in LICENSE-MIT and LICENSE-APACHE, and NOTICE.
|
||||||
|
|
||||||
@@ -268,6 +268,7 @@ profiling 1.0.18 (MIT OR Apache-2.0)
|
|||||||
pxfm 0.1.30 (BSD-3-Clause OR Apache-2.0)
|
pxfm 0.1.30 (BSD-3-Clause OR Apache-2.0)
|
||||||
quick-error 2.0.1 (MIT/Apache-2.0)
|
quick-error 2.0.1 (MIT/Apache-2.0)
|
||||||
quick-xml 0.41.0 (MIT)
|
quick-xml 0.41.0 (MIT)
|
||||||
|
quick-xml 0.42.0 (MIT)
|
||||||
quote 1.0.47 (MIT OR Apache-2.0)
|
quote 1.0.47 (MIT OR Apache-2.0)
|
||||||
r-efi 5.3.0 (MIT OR Apache-2.0 OR LGPL-2.1-or-later)
|
r-efi 5.3.0 (MIT OR Apache-2.0 OR LGPL-2.1-or-later)
|
||||||
r-efi 6.0.0 (MIT OR Apache-2.0 OR LGPL-2.1-or-later)
|
r-efi 6.0.0 (MIT OR Apache-2.0 OR LGPL-2.1-or-later)
|
||||||
@@ -9233,7 +9234,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
quick-xml 0.41.0
|
quick-xml 0.41.0, quick-xml 0.42.0
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ use fieldcraft_model::MAX_COORD;
|
|||||||
/// flattens the object (relative, so a uniform scale is never refused).
|
/// flattens the object (relative, so a uniform scale is never refused).
|
||||||
const MIN_RELATIVE_DET: f64 = 1e-12;
|
const MIN_RELATIVE_DET: f64 = 1e-12;
|
||||||
|
|
||||||
const CORE_NS: &[u8] = b"http://schemas.microsoft.com/3dmanufacturing/core/2015/02";
|
const CORE_NS: &str = "http://schemas.microsoft.com/3dmanufacturing/core/2015/02";
|
||||||
/// SolidCraft's face-tag namespace, version 1.
|
/// SolidCraft's face-tag namespace, version 1.
|
||||||
pub const FACE_TAGS_NS: &str = "https://github.com/bherbruck/solidcraft/formats/3mf-face-tags/2026/10";
|
pub const FACE_TAGS_NS: &str = "https://github.com/bherbruck/solidcraft/formats/3mf-face-tags/2026/10";
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ enum Ns {
|
|||||||
fn ns_of(r: &ResolveResult) -> Ns {
|
fn ns_of(r: &ResolveResult) -> Ns {
|
||||||
match r {
|
match r {
|
||||||
ResolveResult::Bound(n) if n.as_ref() == CORE_NS => Ns::Core,
|
ResolveResult::Bound(n) if n.as_ref() == CORE_NS => Ns::Core,
|
||||||
ResolveResult::Bound(n) if n.as_ref() == FACE_TAGS_NS.as_bytes() => Ns::FaceTags,
|
ResolveResult::Bound(n) if n.as_ref() == FACE_TAGS_NS => Ns::FaceTags,
|
||||||
ResolveResult::Unbound => Ns::Core,
|
ResolveResult::Unbound => Ns::Core,
|
||||||
_ => Ns::Other,
|
_ => Ns::Other,
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ fn ns_of(r: &ResolveResult) -> Ns {
|
|||||||
|
|
||||||
/// An element's attributes as (namespace, local name, value), borrowed from the event (values
|
/// An element's attributes as (namespace, local name, value), borrowed from the event (values
|
||||||
/// are copied only when they hold entity references). Unprefixed attributes are Core.
|
/// are copied only when they hold entity references). Unprefixed attributes are Core.
|
||||||
type Attrs<'a> = Vec<(Ns, &'a [u8], Cow<'a, str>)>;
|
type Attrs<'a> = Vec<(Ns, &'a str, Cow<'a, str>)>;
|
||||||
|
|
||||||
fn attrs<'a, R>(rd: &NsReader<R>, e: &'a BytesStart) -> Result<Attrs<'a>> {
|
fn attrs<'a, R>(rd: &NsReader<R>, e: &'a BytesStart) -> Result<Attrs<'a>> {
|
||||||
let mut out = Vec::with_capacity(4);
|
let mut out = Vec::with_capacity(4);
|
||||||
@@ -107,7 +107,7 @@ fn attrs<'a, R>(rd: &NsReader<R>, e: &'a BytesStart) -> Result<Attrs<'a>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get<'s>(a: &'s Attrs, ns: Ns, key: &str) -> Option<&'s str> {
|
fn get<'s>(a: &'s Attrs, ns: Ns, key: &str) -> Option<&'s str> {
|
||||||
a.iter().find(|(n, k, _)| *n == ns && *k == key.as_bytes()).map(|(_, _, v)| v.as_ref())
|
a.iter().find(|(n, k, _)| *n == ns && *k == key).map(|(_, _, v)| v.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn int(a: &Attrs, ns: Ns, key: &str, what: &str) -> Result<Option<u32>> {
|
fn int(a: &Attrs, ns: Ns, key: &str, what: &str) -> Result<Option<u32>> {
|
||||||
@@ -216,7 +216,7 @@ fn parse_model(xml: &[u8]) -> Result<Model> {
|
|||||||
Event::End(end) => {
|
Event::End(end) => {
|
||||||
depth = depth.saturating_sub(1);
|
depth = depth.saturating_sub(1);
|
||||||
if ns == Ns::Core
|
if ns == Ns::Core
|
||||||
&& end.local_name().as_ref() == b"object"
|
&& end.local_name().as_ref() == "object"
|
||||||
&& let Some((id, o)) = cur.take()
|
&& let Some((id, o)) = cur.take()
|
||||||
{
|
{
|
||||||
m.add(id, o)?;
|
m.add(id, o)?;
|
||||||
@@ -237,13 +237,13 @@ fn parse_model(xml: &[u8]) -> Result<Model> {
|
|||||||
}
|
}
|
||||||
let a = attrs(&rd, &e)?;
|
let a = attrs(&rd, &e)?;
|
||||||
match e.local_name().as_ref() {
|
match e.local_name().as_ref() {
|
||||||
b"model" => {
|
"model" => {
|
||||||
seen_model = true;
|
seen_model = true;
|
||||||
if let Some(u) = get(&a, Ns::Core, "unit") {
|
if let Some(u) = get(&a, Ns::Core, "unit") {
|
||||||
m.unit = unit_mm(u).ok_or_else(|| invalid(format!("unknown unit `{u}`")))?;
|
m.unit = unit_mm(u).ok_or_else(|| invalid(format!("unknown unit `{u}`")))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b"object" => {
|
"object" => {
|
||||||
if cur.is_some() {
|
if cur.is_some() {
|
||||||
return bad("an object inside an object");
|
return bad("an object inside an object");
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ fn parse_model(xml: &[u8]) -> Result<Model> {
|
|||||||
cur = Some((id, o));
|
cur = Some((id, o));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b"vertex" => {
|
"vertex" => {
|
||||||
let Some((_, o)) = cur.as_mut() else { return bad("vertex outside an object") };
|
let Some((_, o)) = cur.as_mut() else { return bad("vertex outside an object") };
|
||||||
vertices += 1;
|
vertices += 1;
|
||||||
if vertices > MAX_ELEMENTS {
|
if vertices > MAX_ELEMENTS {
|
||||||
@@ -270,7 +270,7 @@ fn parse_model(xml: &[u8]) -> Result<Model> {
|
|||||||
}
|
}
|
||||||
o.positions.push([coord(&a, "x")?, coord(&a, "y")?, coord(&a, "z")?]);
|
o.positions.push([coord(&a, "x")?, coord(&a, "y")?, coord(&a, "z")?]);
|
||||||
}
|
}
|
||||||
b"triangle" => {
|
"triangle" => {
|
||||||
let Some((id, o)) = cur.as_mut() else { return bad("triangle outside an object") };
|
let Some((id, o)) = cur.as_mut() else { return bad("triangle outside an object") };
|
||||||
triangles += 1;
|
triangles += 1;
|
||||||
if triangles > MAX_ELEMENTS {
|
if triangles > MAX_ELEMENTS {
|
||||||
@@ -288,11 +288,11 @@ fn parse_model(xml: &[u8]) -> Result<Model> {
|
|||||||
}
|
}
|
||||||
o.triangles.push(t);
|
o.triangles.push(t);
|
||||||
}
|
}
|
||||||
b"component" => {
|
"component" => {
|
||||||
let Some((_, o)) = cur.as_mut() else { return bad("component outside an object") };
|
let Some((_, o)) = cur.as_mut() else { return bad("component outside an object") };
|
||||||
o.components = true;
|
o.components = true;
|
||||||
}
|
}
|
||||||
b"item" => {
|
"item" => {
|
||||||
if m.build.len() >= MAX_BUILD_ITEMS {
|
if m.build.len() >= MAX_BUILD_ITEMS {
|
||||||
return bad(format!("more than {MAX_BUILD_ITEMS} build items"));
|
return bad(format!("more than {MAX_BUILD_ITEMS} build items"));
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ pub fn read_3mf(bytes: &[u8]) -> Result<Vec<TaggedSurface>> {
|
|||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
match rd.read_event_into(&mut buf) {
|
match rd.read_event_into(&mut buf) {
|
||||||
Ok(Event::Start(e)) | Ok(Event::Empty(e)) if e.local_name().as_ref() == b"Relationship" => {
|
Ok(Event::Start(e)) | Ok(Event::Empty(e)) if e.local_name().as_ref() == "Relationship" => {
|
||||||
let a = attrs(&rd, &e)?;
|
let a = attrs(&rd, &e)?;
|
||||||
if get(&a, Ns::Core, "Type").is_some_and(|t| t.ends_with("/3dmodel"))
|
if get(&a, Ns::Core, "Type").is_some_and(|t| t.ends_with("/3dmodel"))
|
||||||
&& let Some(t) = get(&a, Ns::Core, "Target")
|
&& let Some(t) = get(&a, Ns::Core, "Target")
|
||||||
|
|||||||
Reference in new issue
Block a user