Commit Graph

179 Commits

Author SHA1 Message Date
Michael Pfaff e4def7d21c Add some more common escaping scheme identity checks 2024-03-15 19:50:21 -04:00
Michael Pfaff 28a1e3a3f0 Export some escaping utilities, refactor a little bit 2024-03-15 19:44:55 -04:00
Michael Pfaff a5856fb7fc Export some functions 2024-03-15 19:37:12 -04:00
Michael Pfaff faabe73cb2 Refactor to allow more optimized escaping 2024-03-15 19:29:39 -04:00
Michael Pfaff 6e09ca7464 Refactor to support custom escaping schemes 2024-03-15 18:05:31 -04:00
Michael Pfaff d97885392b Silence unused_macros on render_tuple! 2024-03-14 23:02:19 -04:00
Michael Pfaff 19a740f26c impl RenderOnce on tuples of up to 8 values 2024-03-14 23:01:39 -04:00
Michael Pfaff 4e2232f2de Unify Render* and Template* traits 2024-03-11 17:33:11 -04:00
Michael Pfaff e5a471d9ca Improve API 2024-03-11 16:57:52 -04:00
vthg2themax 2e39299483 bump version in preparation for upload to crates.io 2023-10-22 05:01:13 -04:00
vthg2themax 222f69c38a Update Version Number For Latest Release 2023-10-09 15:22:18 -04:00
vthg2themax 9d9351b670 Update Version Numbers Now 2023-07-28 10:20:51 -04:00
vthg2themax 0a5f6c6b5c Update Cargo.lock, README.md, installation.md, and 7 more files Update the version, and publish. 2023-06-22 15:11:54 -04:00
Florian Will 3a9f62610f [Breaking] Add `config` feature for `sailfish` crate
This is for enabling the corresponding `config` feature in
`sailfish-macros` and `sailfish-compiler`. If it is disabled,
configuration files (sailfish.toml) will be ignored. More than 10 cargo
build steps can be avoided this way, since the `toml` and `serde`
dependencies in `sailfish-compiler` are no longer needed.

This change will break applications that use sailfish.toml and
`default-features = false` for the `sailfish` dependency. They need to
add `config` to the list of enabled `sailfish` features in Cargo.toml.

Closes #123
2023-06-21 09:18:32 +02:00
vthg2themax 9b0cd6263c Update Version 2023-04-13 14:09:37 -04:00
liushuyu 2a8e1a7b7d
dep: update syn to v2 (#115)
* dep: update syn to v2

* fix a broken test.

---------

Co-authored-by: Vince Pike <25014503+vthg2themax@users.noreply.github.com>
2023-04-12 10:02:05 -04:00
Vince Pike b293756277
Update The Version In Preparation For Release (#109)
Co-authored-by: Vince Pike <vince@oryp9>
2023-01-24 16:43:15 -05:00
Kogia-sima 658e55d1cc Bump version (0.4.0 => 0.5.0) 2022-10-25 22:44:36 +09:00
Vince Pike 1a40dbbc01 Update Invalid Links 2022-04-22 10:51:59 -04:00
Vince Pike 9955a3acf0 Switch to TOML Format 2022-03-10 15:20:47 -05:00
vince 1a1f87a634 Update netlify references 2022-02-21 09:45:36 -05:00
Kogia-sima 7ff3979888 Update repository URL 2022-02-19 14:47:00 +09:00
Kogia-sima bffe6d1aa1 Bump version (0.3.3 => 0.3.4) 2022-02-13 10:15:34 +09:00
Kogia-sima 8fc70c39fa Bump version (0.3.2 => 0.3.3) 2021-04-06 21:52:20 +09:00
Kogia-sima 62b13b1b8d Fix package description 2021-04-06 20:46:46 +09:00
Kogia-sima 2df4bd1d2d Bump version (0.3.1 => 0.3.2) 2021-03-29 08:47:01 +09:00
Kogia-sima a88aacbc9e perf: improve buffer performance
* Use reserve_small in push_str method
* revert 47818c1 to avoid unnecessary reloading of length
2021-03-29 08:19:13 +09:00
Kogia-sima 77b37aac63 Update itoa (v0.1.0 => v1.0.0) 2021-02-19 01:53:09 +09:00
Kogia-sima 47818c11b7 perf: Use same reallocation strategy as Vec
This change seems to improve performance on some benchmarks (e.g.
techempower), but causes performance regression on another benchmark. We
need to measure performance using more test cases.
2021-02-03 00:50:24 +09:00
Kogia-sima 67f49bdd18 Avoid calling custom memcpy implementation on some platforms
Custom memcpy implementation performs well on the platforms on which
unaligned read/write operation is fast. Otherwise we should use libc
implementation.
2021-01-25 19:54:58 +09:00
Kogia-sima 5209876df4 Bump version (0.3.0 => 0.3.1) 2021-01-23 19:27:25 +09:00
Kogia-sima 000e971fa3 refactor: Use `inline` instead of `inline(always)` 2021-01-11 17:23:23 +09:00
Kogia-sima 30f42f1b46 refactor: Implement faster `render_escaped` method for upper filter 2021-01-11 17:23:23 +09:00
Kogia-sima e69d36b168 refactor: clippy fix 2020-12-29 16:53:46 +09:00
Kogia-sima 25fed05519 test: improve test coverage for runtime 2020-12-29 04:51:08 +09:00
Kogia-sima 2d6b29da6f test: Add more tests 2020-12-29 01:32:56 +09:00
Kogia-sima 6c2ef0deae test: simplify filter tests 2020-12-28 22:44:36 +09:00
Kogia-sima 46fa250c49 feat: allow unsized types for filters 2020-12-28 22:33:49 +09:00
Kogia-sima 28ca4e2959 doc: fix examples in doc comments 2020-12-28 21:28:53 +09:00
Kogia-sima 3ee7d06024 refactor: fmt 2020-12-24 15:50:26 +09:00
Kogia-sima dca8048bd0 perf: Do not compile runtime feature detection on avx2
This feature detection may avoid inlining avx2::escape function
2020-12-24 15:06:01 +09:00
Kogia-sima 54f77cc25a Add debug_assert for Buffer::_set_len 2020-12-24 15:00:19 +09:00
Kogia-sima d127eba2ee fix: Fix compilation issue with Cow<'a, str> 2020-12-21 17:02:32 +09:00
Kogia-sima 1df0657350 Bump version (0.2.3 => 0.3.0) 2020-12-20 22:16:25 +09:00
Kogia-sima 034e7dad45 fix: Fix compilation error due to missing docs 2020-12-20 22:11:13 +09:00
Kogia-sima 8deecff5fe break: change RenderError into enum 2020-12-20 21:55:55 +09:00
Kogia-sima b58a51a1ae doc: deny missing docs 2020-12-20 21:23:47 +09:00
Kogia-sima b6e0f145fa doc: Examples for filters 2020-12-20 21:23:47 +09:00
Kogia-sima bbb16e0e14 perf: New size hint strategy 2020-12-20 20:21:18 +09:00
Kogia-sima f236a98fed perf: reduce memcpy call in HTML escaping 2020-12-20 19:33:13 +09:00
Kogia-sima 36281a7da6 doc: doc comments for buffer methods 2020-12-20 18:23:32 +09:00
Kogia-sima 8cc19b72b8 doc: Document unsafety of Render trait 2020-12-20 16:31:04 +09:00
Kogia-sima 5ceb904f19 fix: Fix unsoundness issue on truncate filter
old implementation of truncate filter is unsound because it may calls
Buffer::set_len() for the index which does not on the char boundary when
buffer sized decreased.
2020-12-20 16:07:06 +09:00
Kogia-sima 7a6b164e9e fix: Remove unsafe usage of ptr::add()
offset passed to add() method must not overflow isize::MAX
2020-12-20 12:16:45 +09:00
Kogia-sima 8de885a4cf fix: Remove incorrect debug_assert 2020-12-19 21:45:26 +09:00
Kogia-sima e1d7c388f5 perf: branch hint in Buffer::reserve 2020-12-19 21:07:09 +09:00
Kogia-sima fa198107a0 fix: Do not panic when buffer size decreased 2020-12-19 20:42:03 +09:00
Kogia-sima ee1952c2eb feat: impl Send/Sync for Buffer 2020-12-19 18:21:48 +09:00
Kogia-sima 70033d604d break: forbit implementing TemplateOnce trait by hand 2020-12-19 17:38:57 +09:00
Kogia-sima c6a3985dfd perf: optimize simd escaping for small strings 2020-12-19 16:58:36 +09:00
Kogia-sima 21fc4af83a doc: comments for feature flags 2020-12-18 19:45:46 +09:00
Kogia-sima f98ed7426f clippy fix 2020-12-18 19:23:20 +09:00
Kogia-sima bf55dd7909 Branch optimization in naive escape 2020-12-18 18:28:21 +09:00
Kogia-sima fe11aff782 Merge branch 'feature/json-filter' 2020-12-18 12:24:43 +09:00
Kogia-sima 28eb155991 Downgrade serde version 2020-12-18 12:21:57 +09:00
Kogia-sima d381552e6b feat: truncate filter 2020-12-18 11:13:14 +09:00
Kogia-sima e899e99ea1 doc: json filter documentation 2020-12-17 19:47:33 +09:00
Kogia-sima d7bce02109 feat: json filter 2020-12-17 19:47:27 +09:00
Kogia-sima 8e07927f19 Add doc_cfg attribute 2020-12-17 17:06:34 +09:00
Kogia-sima daa6f4878d Rename some tests 2020-12-17 16:30:47 +09:00
Kogia-sima e316c82eb5 Remove String::truncate()
Current implementation is unsafe because it doesn't check if `new_len`
does lie on a char boundary.
2020-12-17 16:24:57 +09:00
Kogia-sima 53a9cb9713 fix error with cargo-miri 2020-12-17 15:38:11 +09:00
Kogia-sima 5961a7400b security: Properly handle slices with size greater than isize::MAX
See https://github.com/rust-lang/rust/pull/79930#issuecomment-747135498
for more details.
2020-12-17 10:24:28 +09:00
Kogia-sima 5108988879 Use std::isize::MAX instead of isize::MAX
isize::MAX not working on Rust 1.42.0
2020-12-17 10:09:18 +09:00
Kogia-sima a5f40fe270 Revert "refactor: Use nanorand crate instead of custom xorshift implementation"
This reverts commit d0ec00fb29.
I found that nanorand crate does not work on Mac OSX.
2020-12-17 10:07:53 +09:00
Kogia-sima c182e41622 perf: Optimize Buffer::push()
fix #8
2020-12-16 21:52:39 +09:00
Kogia-sima aa0afb1f81 doc: Update safety documents
and some assertion fix
2020-12-16 21:17:06 +09:00
Kogia-sima 790f7366cf break: Update TemplateOnce trait structure
* Remove render_once_to_string method
* Add render_once_to method
* Now TemplateOnce trait requires both method implementation
* Some performance improvement
2020-12-16 19:01:28 +09:00
Kogia-sima d0ec00fb29 refactor: Use nanorand crate instead of custom xorshift implementation 2020-12-16 16:52:07 +09:00
Kogia-sima 9b733f973f suppress dead_code warning when target_feature = "avx2" 2020-12-16 15:44:20 +09:00
Kogia-sima c7093a727a perf: Replace reserve with reserve_small 2020-12-16 15:18:04 +09:00
Kogia-sima 2d6d913213 no longer requires `extern crate sailfish_macros` 2020-12-16 13:35:37 +09:00
Kogia-sima 72b061ee3e refactor: Use unlikely in Buffer::reserve() 2020-11-30 12:19:03 +09:00
Kogia-sima 541ecb91ef Bump version (0.2.2 => 0.2.3) 2020-11-29 21:40:58 +09:00
Kogia-sima 4d993256fe Add `derive` feature for sailfish crate 2020-11-29 21:39:50 +09:00
Kogia-sima c9b4d08ed0 refactor: hide Buffer::clear() method
This method is dangerous because it might deletes all contents
previouslly rendered.
2020-11-21 18:44:56 +09:00
Kogia-sima 834289be59 refactor: Reduce unsafe blocks 2020-11-21 18:44:52 +09:00
Kogia-sima 82fb9f5469 refactor: Remove unused code 2020-11-21 18:25:36 +09:00
Kogia-sima cfd40f573b Bump version (0.2.1 => v0.2.2) 2020-11-11 10:48:30 +09:00
Kogia-sima 2ba4a99582 Bump version (0.2.0 => 0.2.1) 2020-08-04 09:18:24 +09:00
Kogia-sima d79a5d3b4b perf: Zero-copy conversion from String into Buffer 2020-08-04 03:14:21 +09:00
Kogia-sima 941cd965ab Do not use render_once_to_string method directly 2020-07-26 00:02:51 +09:00
Kogia-sima 4a8ce80e3d improve escape_small() performance 2020-07-23 11:49:53 +09:00
Kogia-sima cc10171b73 Avoid dangerous conversion from String to Buffer 2020-07-22 07:05:15 +09:00
Kogia-sima fcde448751 Add trim filter 2020-07-22 06:40:26 +09:00
Kogia-sima 31bbcaebc8 Avoid capacity overflow in Buffer::with_capacity 2020-07-22 03:25:07 +09:00
Kogia-sima 236dff6b10 Improve size hint update algorithm 2020-07-21 09:00:15 +09:00
Kogia-sima d0ef795161 Bump version (0.1.3 => 0.2.0) 2020-07-17 04:48:29 +09:00
Kogia-sima 80b64fe883 break: Remove Buffer::set_len method
This method allows reducing the buffer size, but it should not be
possible.
Alternatively I added a Buffer::advance method to increase the length.
2020-07-15 19:49:35 +09:00
Kogia-sima 15b0504564 Add tests for filter 2020-07-15 19:34:53 +09:00