Commit graph

70 commits

Author SHA1 Message Date
lumi
90a5eb0d49 Merge branch 'namespaceset' into 'master'
add NamespaceSet implementation

See merge request !14
2017-08-13 18:01:13 +00:00
Astro
2398e4f6d1 Cargo.toml: add Astro to authors 2017-08-13 17:29:48 +02:00
Astro
b141559081 rename namespaces mod to namespace_set 2017-08-13 17:29:38 +02:00
Astro
7297dbc5fd namespaces: add some tests 2017-08-13 02:48:28 +02:00
Astro
0148790a01 move NamespaceSet to namespaces mod 2017-08-13 02:35:24 +02:00
Astro
7d2699e08e NamespaceSet::set_parent(): don't require a full Element
by passing just a reference to a NamespaceSet we could reuse this for
xmlns elision in the serialization code.
2017-08-13 02:28:44 +02:00
Astro
98fd71fd3f NamespaceSet: rm unneeded cast 2017-08-13 02:26:45 +02:00
Astro
26f03c27ed optimize Element::write_to_inner() with CoW 2017-08-13 02:24:40 +02:00
Astro
a01cf553ae switch Element namespaces to NamespaceSet with parent reference 2017-08-13 02:24:34 +02:00
Astro
77bc215cba tests: add namespace inheritance tests 2017-08-13 02:19:17 +02:00
lumi
db3c4e43e3 Merge branch 'escaping' into 'master'
escape text and attribute values

See merge request !15
2017-08-12 11:08:50 +00:00
Astro
052c46635a escape text and attribute values 2017-08-12 02:05:18 +02:00
lumi
8b50dadb92 added changelog 2017-06-10 17:44:28 +02:00
lumi
367234ba83 Merge branch 'quick_xml' into 'master'
Replace xml-rs by quick_xml

See merge request !11
2017-06-10 15:32:22 +00:00
Bastien Orivel
9cec9fce9b Replace xml-rs by quick_xml
quick_xml is way faster than xml-rs

Here is an example with a quick atom parser:
    With xml-rs:
        test parse_factorio_atom ... bench:   3,295,678 ns/iter (+/- 165,851)
    With quick_xml:
        test parse_factorio_atom ... bench:     203,215 ns/iter (+/- 13,485)

Unfortunately I had to break the API for this change to happen.
* Element::from_reader now takes `R: BufRead` instead of `R: Read`
* Element::write_to now takes `W: io::Write` instead of `EventWriter<W: Write>`

This migration also allow us to have a write_to function which assumes
we're already in a given namespace (see `write_to_in_namespace`).
2017-06-10 17:17:19 +02:00
lumi
d6a9e6e9ea implement ToAttributeValue on integral types, bump version 2017-05-28 00:25:57 +02:00
lumi
4166751828 bump version to 0.4.2 2017-05-28 00:02:26 +02:00
lumi
28d17381c6 Merge branch 'u32-u16-u8' into 'master'
Implement IntoAttributeValue for u32, u16 and u8

See merge request !10
2017-05-27 22:00:54 +00:00
Emmanuel Gil Peyrot
638866fa4c implement IntoAttributeValue for u32, u16 and u8 2017-05-27 22:56:17 +01:00
lumi
8f4361c8b1 Merge branch 'usize' into 'master'
Implement IntoAttributeValue for usize

See merge request !9
2017-05-27 21:53:23 +00:00
Emmanuel Gil Peyrot
d63c7b991d implement IntoAttributeValue for usize 2017-05-27 22:45:22 +01:00
lumi
ec31c2b4a3 make CI work, hopefully 2017-05-27 21:37:37 +00:00
lumi
9d45230c17 should re-export more things under the error module 2017-05-22 19:30:52 +02:00
lumi
508c971416 port error.rs to error_chain, bump version to 0.4.0 2017-05-22 19:20:01 +02:00
lumi
6323529cd7 bump version to 0.3.3 2017-05-22 18:50:43 +02:00
lumi
3341d7e692 turns out i was wrong and clippy was right, all hail clippy 2017-05-22 18:49:24 +02:00
lumi
dbcbe7cd9b make clippy happy 2017-05-22 18:45:43 +02:00
lumi
3223fc11fe this will already get auto-dereferenced 2017-05-22 16:15:26 +02:00
lumi
49d25968cb no need to clone that 2017-05-22 16:15:04 +02:00
lumi
f6ad64c910 now at version 0.3.2 2017-05-22 16:09:04 +02:00
lumi
8d7afc0d5c Merge branch 'into-&String' into 'master'
Implement IntoElements and IntoAttributeValue for &String

See merge request !8
2017-05-22 14:05:05 +00:00
Emmanuel Gil Peyrot
f4e5f5380e implement IntoElements and IntoAttributeValue for &String 2017-05-21 21:07:37 +01:00
lumi
cb17ca24c1 bump version to 0.3.1 2017-05-19 13:12:46 +02:00
lumi
83d80dd235 Add iterators over attributes, nodes and text nodes. Clean up lots of code. Add as_element and as_text on Node. Add some inline annotations. 2017-05-14 16:38:56 +02:00
lumi
33f9dee31f move use std::iter::FromIterator to tests 2017-05-03 18:39:40 +02:00
lumi
1bc1437da8 bump version to 0.3.0 2017-05-03 18:37:03 +02:00
lumi
fdfc7e2cb1 Merge branch 'master' into 'master'
Implement From<Element> for String and use it for fmt::Debug

See merge request !7
2017-05-03 16:22:05 +00:00
lumi
5f462e9081 Merge branch 'master' into 'master'
Reexport ElementEmitter from the lib

See merge request !6
2017-05-03 16:19:49 +00:00
Maxime “pep” Buquet
e9d33e5e7e Implement From<Element> for String and use it for fmt::Debug 2017-05-02 16:32:32 +01:00
Emmanuel Gil Peyrot
875b95bdc9 Reexport ElementEmitter from the lib. 2017-04-30 23:46:29 +01:00
lumi
1f7c61e0d6 Merge branch 'xml-rs-0.4.1' into 'master'
Bump xml-rs dependency to 0.4.1

See merge request !5
2017-04-30 14:05:28 +00:00
lumi
1b1e2fa86a Merge branch 'use_btreemap_for_attributes' into 'master'
Use a BTreeMap<String, String> instead of a Vec<Attribute> to store attributes

Closes #4

See merge request !4
2017-04-30 14:00:05 +00:00
Emmanuel Gil Peyrot
154afda327 Bump xml-rs dependency to 0.4.1. 2017-04-27 17:42:00 +01:00
Bastien Orivel
f87e2442d4 Use a BTreeMap<String, String> instead of a Vec<Attribute> to store attributes
This way we don't need to reimplement PartialEq for Element. It's also
way easier to get an attribute by name as we don't need to iterate over
every attribute to see if it exists.

The only side effect is that now, in the Debug output, attributes are
automatically sorted by names instead of being sorted by insertion
order.

Fixes #4
2017-04-26 23:44:58 +02:00
lumi
2aef4aacb8 linewrap license 2017-04-26 01:26:29 +02:00
lumi
8116c6e657 Well, that's embarrassing. Hope nobody will ever look at this commit. (if you see this, please don't look) 2017-04-26 01:15:56 +02:00
lumi
d54b002243 bump to 2.0.0, switch license to MIT 2017-04-26 01:14:16 +02:00
lumi
c6f9cc485f Merge branch 'Eijebong/minidom-rs-fix_namespaced_attributes'
# Conflicts:
#	src/tests.rs
2017-04-26 01:02:17 +02:00
lumi
64f212d11b Merge branch 'fix_equality' into 'master'
Fix the PartialEq implementation for Element

Closes #3

See merge request !3
2017-04-25 22:44:59 +00:00
Eijebong
0d0c4b76eb Fix the PartialEq implementation for Element
The order of attributes in an `Element` doesn't matter anymore.
`<elem a="b" c="d" />` and `<elem c="d" a="b" />` are now correctly
considered equal.

For that I had to derive `PartialOrd` and `Ord` for `Attribute`.
This allows us to sort cloned vectors of `Attribute` in the `PartialEq`
implementation and compare them instead of the struct `attributes`.

Fixes #3
2017-04-24 21:15:53 +02:00