commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
bc89522171b40fb1c31e6d5fa823bfcd48e89879 | Adam Reichold | 2021-03-22T16:23:18 | Extend MmapOptions to support setting MAP_POPULATE and thereby trigger readahead. | diff --git a/src/lib.rs b/src/lib.rs
index b408ba8..e113a4b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -44,6 +44,7 @@ pub struct MmapOptions {
offset: u64,
len: Option<usize>,
stack: bool,
+ populate: bool,
}
impl MmapOptions {
@@ -144,7 +145,7 @@ impl MmapOptions {
/// Configures the anon... | 3 | 83 | 22 |
e042b5eae71202a4f4d31075a75b219ecda4d14b | diwic | 2021-02-08T15:27:51 | Add MmapRaw | diff --git a/src/lib.rs b/src/lib.rs
index 9b6cf06..9ba6347 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -317,6 +317,17 @@ impl MmapOptions {
pub fn map_anon(&self) -> Result<MmapMut> {
MmapInner::map_anon(self.len.unwrap_or(0), self.stack).map(|inner| MmapMut { inner: inner })
}
+
+ /// Creates a ... | 1 | 85 | 0 |
a02369b44b06095e97db8bf213d41a2ddaa55ddd | CensoredUsername | 2020-12-16T13:27:22 | Make anonymous memory maps private by default on unix.
Currently map_anon will call mmap with MAP_SHARED | MAP_ANON.
This prevents debuggers from easily working with executable code inside these mmaps as MAP_SHARED implies any changes made to the mmap will be flushed to a file or to other processes. However, it is ... | diff --git a/src/unix.rs b/src/unix.rs
index 3673785..d8437a9 100644
--- a/src/unix.rs
+++ b/src/unix.rs
@@ -122,7 +122,7 @@ impl MmapInner {
MmapInner::new(
len,
libc::PROT_READ | libc::PROT_WRITE,
- libc::MAP_SHARED | libc::MAP_ANON | stack,
+ libc::MAP_PRIVATE... | 1 | 1 | 1 |
cc7a606898fd2251de0c9bce799089b89d3ef3f6 | zserik | 2020-12-16T13:26:48 | Add map_copy_read_only. | diff --git a/src/lib.rs b/src/lib.rs
index 6fcabb4..bea0352 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,8 +22,8 @@ use std::usize;
/// A memory map builder, providing advanced options and flags for specifying memory map behavior.
///
/// `MmapOptions` can be used to create an anonymous memory map using [`map_ano... | 3 | 89 | 2 |
49e8c1d6c1d753fe587fadf45697f080a0a888d7 | Evgeniy Reizner | 2020-01-10T12:58:16 | Reset version. | diff --git a/Cargo.toml b/Cargo.toml
index 5208645..abc6d6e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memmap2"
-version = "0.7.0"
+version = "0.1.0"
authors = ["Dan Burkert <dan@danburkert.com>", "Evgeniy Reizner <razrfalcon@gmail.com>"]
license = "MIT/Apache-2.0"
repository = "htt... | 2 | 2 | 2 |
3b047cc2b04558d8a1de3933be5f573c74bc8e0f | David Kellum | 2018-04-18T20:35:54 | Improve documentation
primarily adds safety notes for unsafe file-backed maps. Such a general
note doesn't have to be "authoritative" or a treatise on the nuances of
every supported platform in order to give users a useful starting point
in assessing the (un-)safety. GitHub cc: #70
Also switches docs to use the new r... | diff --git a/src/lib.rs b/src/lib.rs
index 5010c00..24b6d42 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,9 +23,23 @@ use std::usize;
/// A memory map builder, providing advanced options and flags for specifying memory map behavior.
///
-/// `MmapOptions` can be used to create an anonymous memory map using `MmapO... | 1 | 66 | 14 |
83f3802374a485c016c196bcc81c9dc8e93187d7 | Dan Burkert | 2018-09-20T04:36:53 | Fix large offset/lengths on 32-bit platforms | diff --git a/src/lib.rs b/src/lib.rs
index d8f5efe..be42a57 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -119,14 +119,14 @@ impl MmapOptions {
/// Returns the configured length, or the length of the provided file.
fn get_len(&self, file: &File) -> Result<usize> {
self.len.map(Ok).unwrap_or_else(|| {
-... | 1 | 7 | 10 |
d32bfde771cd2ffe649f93d1a73a96045e1827e2 | Dan Burkert | 2018-09-16T02:50:53 | Remove try_main from doc examples | diff --git a/src/lib.rs b/src/lib.rs
index 970fa92..d8f5efe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,7 +42,7 @@ impl MmapOptions {
/// use memmap::{MmapMut, MmapOptions};
/// # use std::io::Result;
///
- /// # fn try_main() -> Result<()> {
+ /// # fn main() -> Result<()> {
/// // Create... | 1 | 13 | 26 |
90fce70e66c75614b5e9886131b96daecc113bad | Zachary Dremann | 2018-04-18T02:01:22 | File offsets should be u64, not usize
This is a breaking change. | diff --git a/src/lib.rs b/src/lib.rs
index 0ff18f9..9f6d64c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,7 +28,7 @@ use std::ops::{Deref, DerefMut};
/// `MmapOptions::map_exec`, or `MmapOptions::map_copy`.
#[derive(Clone, Debug, Default)]
pub struct MmapOptions {
- offset: usize,
+ offset: u64,
len: Op... | 3 | 28 | 21 |
4bddf3f5cd44c82114d027dd4a50ce3ef495d47d | Zverev Konstantin | 2018-01-06T21:29:16 | Add AsRef and AsMut implementation. (#60)
add AsRef and AsMut implementation | diff --git a/src/lib.rs b/src/lib.rs
index 5b158c0..3a5c03c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -398,6 +398,13 @@ impl Deref for Mmap {
}
}
+impl AsRef<[u8]> for Mmap {
+ #[inline]
+ fn as_ref(&self) -> &[u8] {
+ self.deref()
+ }
+}
+
impl fmt::Debug for Mmap {
fn fmt(&self, fmt: &... | 1 | 21 | 0 |
b9c7757252f7244c87deeda9fbe0010c66f95e14 | Dan Burkert | 2018-01-06T21:28:47 | Bump winapi to 0.3 (#62) | diff --git a/Cargo.toml b/Cargo.toml
index 846a321..2084422 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,8 +17,7 @@ appveyor = { repository = "danburkert/mmap" }
libc = "0.2"
[target.'cfg(windows)'.dependencies]
-winapi = "0.2"
-kernel32-sys = "0.2"
+winapi = { version = "0.3", features = ["basetsd", "handleapi"... | 3 | 97 | 82 |
cc55727a5a759d2700e8619600c75a935f4440dd | Steven Fackler | 2017-11-09T02:39:55 | Inline deref codepath methods (#58)
No need for a function call every time we deref! | diff --git a/src/lib.rs b/src/lib.rs
index 9b3ee66..4155b19 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -389,6 +389,8 @@ impl Mmap {
impl Deref for Mmap {
type Target = [u8];
+
+ #[inline]
fn deref(&self) -> &[u8] {
unsafe { slice::from_raw_parts(self.inner.ptr(), self.inner.len()) }
}
@@ ... | 3 | 11 | 0 |
f931cb075d96b3de613ffdde1b5f7b0613b2ab5d | Dan Burkert | 2017-10-30T00:15:09 | Fix broken doctest | diff --git a/src/lib.rs b/src/lib.rs
index 23099ca..9b3ee66 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -78,8 +78,8 @@ impl MmapOptions {
/// .offset(10)
/// .map(&File::open("README.md")?)?
/// };
- /// assert_eq!(&b"A Rust library for cross-platform memory mapped file... | 1 | 2 | 2 |
5ff8bc3b604cdd43061a2410d68bd242e32aaab6 | Ottavio M. Hartman | 2017-05-30T03:45:45 | Added examples to methods. (#45)
Watch out: some examples are `no_run` because they show writing to files. | diff --git a/src/lib.rs b/src/lib.rs
index 3e8f4ad..98ce23c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,32 @@ use std::ops::{Deref, DerefMut};
/// Determines how a memory map may be used. If the memory map is backed by a
/// file, then the file must have permissions corresponding to the operations
/// the ... | 1 | 379 | 5 |
d037b271a63e8991b5b5647b666d3ee568607e4e | Dan Burkert | 2017-05-29T19:31:48 | temp: add doc test with ? | diff --git a/src/lib.rs b/src/lib.rs
index 3e8f4ad..0149225 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,11 @@
//! A cross-platform Rust API for memory maps.
+//!
+//! ```rust
+//! fn foo() -> ::std::io::Result<()> {
+//! ::std::fs::File::open("/tmp/foo")?;
+//! Ok(())
+//! }
+//! ```
#![deny(warning... | 1 | 7 | 0 |
da7000b09478d1e94c66ba647a12450be93fa159 | Sergey Bugaev | 2017-05-22T12:59:35 | Overhaul the API (#42)
Overhaul the API | diff --git a/examples/cat.rs b/examples/cat.rs
index 807e9e7..0b3c42e 100644
--- a/examples/cat.rs
+++ b/examples/cat.rs
@@ -2,15 +2,17 @@ extern crate memmap;
use std::env;
use std::io::{self, Write};
-
-use memmap::{Mmap, Protection};
+use std::fs::File;
/// Output a file's contents to stdout. The file path mu... | 4 | 401 | 227 |
ff72dd2cb52e90f6516b0501c972a362f2284470 | Sergey Bugaev | 2017-05-11T19:03:40 | Remove MmapView and MmapViewSync | diff --git a/src/lib.rs b/src/lib.rs
index 7bd467f..71f8ace 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,14 +13,11 @@ mod unix;
#[cfg(unix)]
use unix::MmapInner;
-use std::cell::UnsafeCell;
use std::fmt;
use std::fs::{self, File};
use std::io::{Error, ErrorKind, Result};
use std::path::Path;
-use std::rc::Rc... | 1 | 0 | 395 |
465fe46c8ba6a354818c7b7d297403fd114484ab | opilarium | 2017-05-10T17:21:51 | Add #[doc(html_root_url)] annotation to crate root | diff --git a/Cargo.toml b/Cargo.toml
index 83093dc..c2b8f3c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "memmap"
+# NB: When modifying, also modify html_root_url in lib.rs
version = "0.5.2"
authors = ["Dan Burkert <dan@danburkert.com>"]
license = "MIT/Apache-2.0"
diff --git a/src/lib.... | 2 | 2 | 0 |
85796bb7bd344259327ad44fa020e69a5f33b69b | Cameron Dershem | 2017-05-09T07:19:04 | Adds badges to Cargo.toml #35 | diff --git a/Cargo.toml b/Cargo.toml
index bcf3914..83093dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,10 @@ documentation = "https://docs.rs/memmap"
description = "Cross-platform Rust API for memory-mapped file IO"
keywords = ["mmap", "memory-map", "io", "file"]
+[badges]
+travis-ci = { repository = "danb... | 1 | 4 | 0 |
8b40d4d2a56ce1493a77930b94f448412d4d3ea0 | Samuel Tardieu | 2017-05-09T11:37:04 | Simplify boolean expression | diff --git a/src/lib.rs b/src/lib.rs
index fe578de..68a67a6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -60,10 +60,7 @@ impl Protection {
/// Returns `true` if the `Protection` is writable.
pub fn write(self) -> bool {
- match self {
- Protection::ReadWrite | Protection::ReadCopy => true,
... | 1 | 1 | 4 |
1c6a888bb51301d7cdde70423f144e111369e5b1 | Samuel Tardieu | 2017-05-09T11:35:30 | mmap with ReadCopy protection on Unix does not need a writable file
Although this is needed for Windows, there is no reason to use a
wider mode than necessary for Unix. | diff --git a/src/lib.rs b/src/lib.rs
index 89643cf..fe578de 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,7 +52,8 @@ impl Protection {
fn as_open_options(self) -> fs::OpenOptions {
let mut options = fs::OpenOptions::new();
options.read(true)
- .write(self.write());
+ ... | 3 | 14 | 1 |
2b0c4a9606124a377fda96e243383b6a43921cec | Dan Burkert | 2017-02-25T23:07:01 | Check for usize overflow when mapping files
Fixes #27 | diff --git a/src/lib.rs b/src/lib.rs
index 15a5bf8..89643cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,6 +20,7 @@ use std::path::Path;
use std::rc::Rc;
use std::slice;
use std::sync::Arc;
+use std::usize;
/// Memory map protection.
///
@@ -107,8 +108,12 @@ impl Mmap {
/// The file must be opened with r... | 1 | 13 | 4 |
3fbda703d19e41b45f90469be28c22f0cab60404 | Dan Burkert | 2017-02-25T23:00:43 | Bump fs2 version | diff --git a/Cargo.toml b/Cargo.toml
index e1b35bb..d384dae 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ libc = "0.2"
[target.'cfg(windows)'.dependencies]
winapi = "0.2"
-fs2 = "0.3"
+fs2 = "0.4"
kernel32-sys = "0.2"
[dev-dependencies] | 1 | 1 | 1 |
029095cfed57963408395f249e73cfc7c88c40c6 | Dan Burkert | 2016-10-22T20:39:42 | Bump fs2 version | diff --git a/Cargo.toml b/Cargo.toml
index ab31fb9..3d6845a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ libc = "0.2"
[target.'cfg(windows)'.dependencies]
winapi = "0.2"
-fs2 = "0.2"
+fs2 = "0.3"
kernel32-sys = "0.2"
[dev-dependencies] | 1 | 1 | 1 |
ad20dc9d6d2c4f2d33b279dc86089ccc41c2d448 | Jonas Schievink | 2016-06-25T00:19:09 | Allow executable mappings (#22)
* Allow executable mappings
Adds `Protection::ReadExec` and `Mmap::set_protection`.
Includes an x86 JIT test.
It was necessary to change the implementation of anonymous mappings on
Windows so that we can easily change the protection using `VirtualProtect`.
Windows makes memor... | diff --git a/src/lib.rs b/src/lib.rs
index 14ceb7a..15a5bf8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -41,6 +41,9 @@ pub enum Protection {
/// changes made to the file after the memory map is created will be
/// visible.
ReadCopy,
+
+ /// A readable and executable mapping.
+ ReadExecute,
}
im... | 3 | 150 | 4 |
dd1b685b9eece5e187cb576456b73ebb583091cb | Dan Burkert | 2016-04-03T22:11:01 | flush should take const reference | diff --git a/src/lib.rs b/src/lib.rs
index af7cbb0..14ceb7a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -151,7 +151,7 @@ impl Mmap {
/// When this returns with a non-error result, all outstanding changes to a
/// file-backed memory map are guaranteed to be durably stored. The file's
/// metadata (includi... | 3 | 13 | 13 |
1019769f82fe9fce0557a239015cdb3bdb830c97 | Dan Burkert | 2016-04-03T22:09:37 | impl Debug | diff --git a/src/lib.rs b/src/lib.rs
index 8ae8104..af7cbb0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,7 @@ mod unix;
use unix::MmapInner;
use std::cell::UnsafeCell;
+use std::fmt;
use std::fs::{self, File};
use std::io::{Error, ErrorKind, Result};
use std::path::Path;
@@ -250,12 +251,16 @@ impl Mmap ... | 1 | 21 | 4 |
ac68f9348b16d32ecd1c237e0bd2a4764c7efd30 | Dan Burkert | 2015-12-05T23:30:26 | Add unsafe clone to mmap views | diff --git a/src/lib.rs b/src/lib.rs
index 9c7383f..8ae8104 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -374,6 +374,18 @@ impl MmapView {
pub unsafe fn as_mut_slice(&mut self) -> &mut [u8] {
&mut self.inner_mut().as_mut_slice()[self.offset..self.offset + self.len]
}
+
+ /// Clones the view of the ... | 1 | 24 | 0 |
2df9b86151951f1ac605c7e394feb32222bfbee3 | Dan Burkert | 2015-11-07T09:48:28 | check for 0 length mmap and simplify offset logic on drop | diff --git a/src/unix.rs b/src/unix.rs
index 6b479f6..5a738aa 100644
--- a/src/unix.rs
+++ b/src/unix.rs
@@ -56,6 +56,11 @@ impl MmapInner {
let alignment = offset % page_size();
let aligned_offset = offset - alignment;
let aligned_len = len + alignment;
+ if aligned_len == 0 {
+ ... | 2 | 7 | 2 |
a7c08e07822abed1e6c8dc77c485c4d9e9203c10 | Dan Burkert | 2015-11-06T03:52:07 | bump libc to 0.2 | diff --git a/Cargo.toml b/Cargo.toml
index 564bab0..90ae93c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,10 +14,10 @@ exclude = [
]
[dependencies]
-fs2 = "0.2.0"
-kernel32-sys = "0.1.4"
-libc = "0.1"
-winapi = "0.2.4"
+fs2 = "0.2"
+kernel32-sys = "0.1"
+libc = "0.2"
+winapi = "0.2"
[dev-dependencies]
-tempdir... | 2 | 16 | 6 |
dde407878847d4bea61677cd3a08664f4a52129d | Dan Burkert | 2015-11-06T03:50:43 | limit comments to 80 chars | diff --git a/src/lib.rs b/src/lib.rs
index 269cc8d..9c7383f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,21 +22,23 @@ use std::sync::Arc;
/// Memory map protection.
///
-/// Determines how a memory map may be used. If the memory map is backed by a file, then the file
-/// must have permissions corresponding to t... | 1 | 67 | 56 |
0728b16dbf1071bea95b2abb6b9d6f668416e4c2 | Jan-Erik Rediger | 2015-11-05T22:47:35 | Use version below 0.2 | diff --git a/Cargo.toml b/Cargo.toml
index c3080ba..564bab0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ exclude = [
[dependencies]
fs2 = "0.2.0"
kernel32-sys = "0.1.4"
-libc = "0.2.1"
+libc = "0.1"
winapi = "0.2.4"
[dev-dependencies] | 1 | 1 | 1 |
7db3181d84200957660a79fde521741da7641b23 | Jan-Erik Rediger | 2015-11-05T22:39:16 | Fix versions of used dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 795c061..c3080ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,10 +14,10 @@ exclude = [
]
[dependencies]
-fs2 = "*"
-kernel32-sys = "*"
-libc = "*"
-winapi = "*"
+fs2 = "0.2.0"
+kernel32-sys = "0.1.4"
+libc = "0.2.1"
+winapi = "0.2.4"
[dev-dependencies]
-tempdir = "*"... | 1 | 5 | 5 |
51b4fcec7558aec98010715eb6b83b76c7a33250 | Dan Burkert | 2015-09-20T20:13:18 | Align arguments to msync (flush_range on unix) | diff --git a/src/lib.rs b/src/lib.rs
index 46d81ec..269cc8d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -577,13 +577,31 @@ mod test {
let mut read = [0u8; 6];
let mut mmap = Mmap::open_path(&path, Protection::ReadWrite).unwrap();
- unsafe { mmap.as_mut_slice() }.write(write).unwrap();
+ ... | 2 | 28 | 4 |
ae3614084a57f242bee46fde1a46b9f3ff67a12f | Dan Burkert | 2015-10-10T18:09:59 | Windows: use SIZE_T instead of fixed width where appropriate | diff --git a/src/windows.rs b/src/windows.rs
index 2e52ed8..dd0353d 100644
--- a/src/windows.rs
+++ b/src/windows.rs
@@ -109,7 +109,7 @@ impl MmapInner {
pub fn flush_async(&mut self, offset: usize, len: usize) -> io::Result<()> {
let result = unsafe { kernel32::FlushViewOfFile(self.ptr.offset(offset as... | 1 | 1 | 1 |
f04a508b7e806569de41d3256e111dd94599e145 | Dan Burkert | 2015-08-30T22:07:41 | remove unused bitflags dependency | diff --git a/Cargo.toml b/Cargo.toml
index 5c86572..77ece34 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,6 @@ exclude = [
]
[dependencies]
-bitflags = "*"
fs2 = "*"
kernel32-sys = "*"
libc = "*"
diff --git a/src/lib.rs b/src/lib.rs
index fc9a6f8..46d81ec 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,9 ... | 2 | 0 | 4 |
d111e73bdc9cff88d87ddfc4bb3c1f7cc6001426 | Dan Burkert | 2015-09-02T05:10:27 | Mmap::open should take file argument by ref | diff --git a/Cargo.toml b/Cargo.toml
index 97ad294..b8b313b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ exclude = [
[dependencies]
bitflags = "*"
+fs2 = "*"
kernel32-sys = "*"
libc = "*"
winapi = "*"
diff --git a/src/lib.rs b/src/lib.rs
index 3161d35..fc9a6f8 100644
--- a/src/lib.rs
+++ b/src/lib.... | 4 | 15 | 10 |
8942e6b9fb83496cbb780413d29428abcb42ea66 | Dan Burkert | 2015-08-16T21:43:05 | view split_at and restrict should return a result | diff --git a/src/lib.rs b/src/lib.rs
index a0af665..7f10896 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,11 +15,12 @@ mod unix;
#[cfg(unix)]
use unix::MmapInner;
-use std::{io, slice};
use std::cell::UnsafeCell;
use std::fs::{self, File};
+use std::io::{Error, ErrorKind, Result};
use std::path::Path;
use std... | 1 | 56 | 40 |
dd9761f76362296d4c08f3d5446520936072ea1e | Dan Burkert | 2015-08-16T21:31:54 | implement MmapView::restrict | diff --git a/src/lib.rs b/src/lib.rs
index f5d2521..a0af665 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -240,7 +240,7 @@ pub struct MmapView {
impl MmapView {
- /// Split the view into disjoint pieces.
+ /// Split the view into disjoint pieces at the specified offset.
///
/// The provided offset mu... | 1 | 32 | 8 |
56706bc293ec3f935d0a7f73909229ba3e9a6cfa | Dan Burkert | 2015-08-16T21:04:01 | implement Mmap::flush_range and Mmap::flush_async_range | diff --git a/src/lib.rs b/src/lib.rs
index d9e831d..f5d2521 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -132,7 +132,8 @@ impl Mmap {
/// map are guaranteed to be durably stored. The file's metadata (including last modification
/// timestamp) may not be updated.
pub fn flush(&mut self) -> io::Result<()> {... | 3 | 88 | 13 |
e5cbbe758afbb0b00aab8ccdde1aeee21695258d | Dan Burkert | 2015-08-16T20:02:38 | implement MmapViewSync | diff --git a/src/lib.rs b/src/lib.rs
index 9211926..d9e831d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,6 +20,7 @@ use std::cell::UnsafeCell;
use std::fs::{self, File};
use std::path::Path;
use std::rc::Rc;
+use std::sync::Arc;
/// Memory map protection.
///
@@ -180,12 +181,21 @@ impl Mmap {
slice::... | 1 | 146 | 1 |
ee5c5053f618ce955005dedaf06067d4f5f0252a | Dan Burkert | 2015-08-16T19:46:14 | implement MmapView | diff --git a/src/lib.rs b/src/lib.rs
index 2a939c8..9211926 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-//! A cross-platform Rust API for memory-mapped file IO.
+//! A cross-platform Rust API for memory maps.
#![deny(warnings)]
@@ -16,8 +16,10 @@ mod unix;
use unix::MmapInner;
use std::{io, slice... | 1 | 136 | 3 |
a37ccdeff87369e0d947ec6627881a599de5dbbb | Dan Burkert | 2015-08-16T22:21:09 | rename posix module to unix | diff --git a/src/lib.rs b/src/lib.rs
index 068f247..2a939c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,9 +11,9 @@ mod windows;
use windows::MmapInner;
#[cfg(unix)]
-mod posix;
+mod unix;
#[cfg(unix)]
-use posix::MmapInner;
+use unix::MmapInner;
use std::{io, slice};
use std::fs::{self, File};
diff --git a... | 2 | 2 | 2 |
2a641a869596d8299126586196f56bc1f879d97d | Peter Atashian | 2015-07-17T15:02:46 | Unused import
Signed-off-by: Peter Atashian <retep998@gmail.com> | diff --git a/src/windows.rs b/src/windows.rs
index b6314a9..b229176 100644
--- a/src/windows.rs
+++ b/src/windows.rs
@@ -1,7 +1,7 @@
extern crate kernel32;
extern crate winapi;
-use std::{self, fs, io, ptr, slice};
+use std::{fs, io, ptr, slice};
use std::ops::{Deref, DerefMut};
use std::os::raw::c_void;
use std... | 1 | 1 | 1 |
20edd98cdd08291ea8ab9d832b06c1b1b8dcb792 | Dan Burkert | 2015-07-15T08:10:50 | Depend on winapi crate | diff --git a/Cargo.toml b/Cargo.toml
index 782fea3..f38a0d7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,8 +5,9 @@ authors = ["Dan Burkert <dan@danburkert.com>"]
[dependencies]
bitflags = "*"
-libc = "*"
kernel32-sys = "*"
+libc = "*"
+winapi = "*"
[dev-dependencies]
tempdir = "*" | 1 | 2 | 1 |
c061471ff6a00f39fe43957e6c88552eec879e22 | Dan Burkert | 2015-07-15T07:59:31 | Simplify cfg attributes | diff --git a/src/lib.rs b/src/lib.rs
index 2a0c2ac..521110d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,23 +8,9 @@ mod windows;
#[cfg(target_os = "windows")]
use windows::MmapInner;
-#[cfg(any(target_os = "linux",
- target_os = "android",
- target_os = "macos",
- target_os = "ios",
- ... | 1 | 2 | 16 |
8f431edd6067d30b229ba1ebea6517a78183b463 | Dan Burkert | 2015-07-15T07:57:37 | Fix winapi imports | diff --git a/src/lib.rs b/src/lib.rs
index 2916850..2a0c2ac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,19 +3,6 @@
#[macro_use]
extern crate bitflags;
-#[cfg(any(target_os = "linux",
- target_os = "android",
- target_os = "macos",
- target_os = "ios",
- target_os = "freebsd",
... | 3 | 18 | 30 |
a458d05e50a1ea6ff7a4d2f64e4bd5af7272584c | Dan Burkert | 2015-07-15T07:45:25 | remove libc dependency on Windows | diff --git a/src/lib.rs b/src/lib.rs
index 674c1cf..2916850 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,15 @@
#[macro_use]
extern crate bitflags;
+
+#[cfg(any(target_os = "linux",
+ target_os = "android",
+ target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd"... | 2 | 31 | 22 |
01c831909470cb2dc67b40379f4a1ddc7d2ff830 | Dan Burkert | 2015-07-15T07:28:13 | Use stdlib c_void instead of libc on Windows | diff --git a/src/windows.rs b/src/windows.rs
index 99dcda4..3b438df 100644
--- a/src/windows.rs
+++ b/src/windows.rs
@@ -1,6 +1,7 @@
use std::{self, fs, io, ptr, slice};
use std::ops::{Deref, DerefMut};
use std::path::Path;
+use std::os::raw::c_void;
use kernel32;
use libc;
@@ -30,7 +31,7 @@ impl Protection {
... | 1 | 3 | 2 |
a503dd6fea043af244423aa88cb63a48c8e49318 | Dan Burkert | 2015-07-15T07:01:31 | impl Send for Mmap | diff --git a/src/lib.rs b/src/lib.rs
index 7583db5..674c1cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -257,6 +257,7 @@ mod test {
use std::{fs, iter};
use std::io::{Read, Write};
+ use std::thread;
use super::*;
@@ -387,4 +388,13 @@ mod test {
mmap[0] = 42;
assert_eq!(42, mma... | 3 | 14 | 1 |
2374646c097caca09009618a08392174a407e556 | Dan Burkert | 2015-07-15T06:52:38 | Fix Mmap::{index, index_mut} infinite recursion | diff --git a/src/lib.rs b/src/lib.rs
index 7ad0488..7583db5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -185,13 +185,13 @@ impl Index<usize> for Mmap {
type Output = u8;
fn index(&self, index: usize) -> &u8 {
- &(*self)[index]
+ &(*self.inner)[index]
}
}
impl IndexMut<usize> for Mmap ... | 1 | 9 | 2 |
847bd82075084cc3db2f51fc6daa125c62404b30 | Dan Burkert | 2015-07-10T03:32:12 | use cargo version of kernel32-sys | diff --git a/Cargo.toml b/Cargo.toml
index 0f9f2a5..782fea3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,10 +6,7 @@ authors = ["Dan Burkert <dan@danburkert.com>"]
[dependencies]
bitflags = "*"
libc = "*"
-
-[dependencies.kernel32-sys]
-git = "https://github.com/retep998/winapi-rs.git"
-path = "lib/kernel32-sys"
+k... | 1 | 1 | 4 |
d95560254470513457cbb40cfe0b42aeb051dced | Dan Burkert | 2015-04-11T21:07:07 | beta compatibility | diff --git a/src/lib.rs b/src/lib.rs
index e5f9db9..7ad0488 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,5 @@
//! A cross-platform Rust API for memory-mapped file IO.
-#![cfg_attr(test, feature(page_size))]
-
#[macro_use]
extern crate bitflags;
extern crate libc;
@@ -257,14 +255,14 @@ impl IndexMut<RangeFu... | 1 | 3 | 5 |
c996bd5e43b2a12d011a6e88087efaddd8f4fafa | Dan Burkert | 2015-04-11T20:05:30 | rename MapKind back to Protection | diff --git a/examples/cat.rs b/examples/cat.rs
index 6b32c37..ea1a111 100644
--- a/examples/cat.rs
+++ b/examples/cat.rs
@@ -3,14 +3,14 @@ extern crate mmap;
use std::env;
use std::io::{self, Write};
-use mmap::{Mmap, MapKind};
+use mmap::{Mmap, Protection};
/// Output a file's contents to stdout. The file path ... | 4 | 56 | 56 |
ad090de72bfcfde392e2087f626a42757b40649a | Dan Burkert | 2015-04-11T19:07:13 | use upstream winapi crate | diff --git a/Cargo.toml b/Cargo.toml
index 4515bce..0f9f2a5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,13 +7,9 @@ authors = ["Dan Burkert <dan@danburkert.com>"]
bitflags = "*"
libc = "*"
-[dev-dependencies]
-tempdir = "*"
-
-[target.x86_64-pc-windows-gnu.dependencies.kernel32-sys]
-git = "https://github.com/dan... | 1 | 4 | 8 |
a1f658fcb5cba1e19c701a95c72335c5a219fda9 | Dan Burkert | 2015-04-08T07:30:11 | add documentation | diff --git a/src/lib.rs b/src/lib.rs
index 3463992..5c8657f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,5 @@
+//! A cross-platform Rust API for memory-mapped file IO.
+
#![cfg_attr(test, feature(page_size))]
#[macro_use]
@@ -42,7 +44,7 @@ use std::path::Path;
use MapKind::*;
-/// Memory map kind
+/// M... | 1 | 38 | 3 |
b6ed8c041584c377a7299abccb5cc785def12e59 | Dan Burkert | 2015-04-08T06:22:12 | rename Protection to MapKind; add ReadCopy kind; remove executable kinds | diff --git a/examples/cat.rs b/examples/cat.rs
index ea1a111..6b32c37 100644
--- a/examples/cat.rs
+++ b/examples/cat.rs
@@ -3,14 +3,14 @@ extern crate mmap;
use std::env;
use std::io::{self, Write};
-use mmap::{Mmap, Protection};
+use mmap::{Mmap, MapKind};
/// Output a file's contents to stdout. The file path ... | 4 | 101 | 82 |
00ea0c3352ecdbfa8f0c752790f1866d5c610b4f | Dan Burkert | 2015-04-08T05:43:27 | split platforms into independent files | diff --git a/src/lib.rs b/src/lib.rs
index 6b1d31c..558e16b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,7 +7,31 @@ extern crate libc;
#[cfg(target_os = "windows")]
extern crate kernel32;
-use std::{fs, io, ptr, slice};
+#[cfg(target_os = "windows")]
+mod windows;
+#[cfg(target_os = "windows")]
+use windows::Mmap... | 3 | 294 | 225 |
bcaa5326487595459c18d7ed13efeb673aa046c8 | Dan Burkert | 2015-04-08T05:08:43 | add cat example | diff --git a/examples/cat.rs b/examples/cat.rs
new file mode 100644
index 0000000..ea1a111
--- /dev/null
+++ b/examples/cat.rs
@@ -0,0 +1,16 @@
+extern crate mmap;
+
+use std::env;
+use std::io::{self, Write};
+
+use mmap::{Mmap, Protection};
+
+/// Output a file's contents to stdout. The file path must be provided as ... | 1 | 16 | 0 |
524e0597631c48f1f1d7bcff83b9d206bd31a64c | Dan Burkert | 2015-04-08T03:27:01 | use externel kernel32 bindings for windows | diff --git a/Cargo.toml b/Cargo.toml
index 9e75ae1..4515bce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,3 +9,11 @@ libc = "*"
[dev-dependencies]
tempdir = "*"
+
+[target.x86_64-pc-windows-gnu.dependencies.kernel32-sys]
+git = "https://github.com/danburkert/winapi-rs.git"
+path = "lib/kernel32-sys"
+
+[target.i68... | 2 | 21 | 14 |
4c05612e066e1f369ae29e2f493fbe179b512ff2 | Dan Burkert | 2015-04-07T22:26:27 | add Mmap::flush() & Mmap::flush_async() | diff --git a/src/lib.rs b/src/lib.rs
index 6f85c39..bdd9e61 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -110,6 +110,14 @@ impl Protection {
}
}
+#[cfg(any(target_os = "linux",
+ target_os = "android",
+ target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ ... | 1 | 117 | 22 |
30214dd90d80c9b5da67d97b3c33a4db797334e0 | Dan Burkert | 2015-04-07T21:00:16 | add Drop impl for Mmap | diff --git a/src/lib.rs b/src/lib.rs
index 9a1cc60..6f85c39 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-#![feature(unique)]
#![cfg_attr(test, feature(page_size))]
#[macro_use]
@@ -112,7 +111,7 @@ impl Protection {
}
pub struct Mmap {
- ptr: ptr::Unique<u8>,
+ ptr: *mut libc::c_void,
len... | 1 | 34 | 9 |
6d473d66565b973d8b61a150f07287d8732e2625 | Ingvar Stepanyan | 2025-09-15T00:51:18 | Clippy fixup | diff --git a/src/de.rs b/src/de.rs
index 89be4ef..715e32f 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -79,7 +79,7 @@ impl ObjectAccess {
}
}
-fn str_deserializer(s: &str) -> de::value::StrDeserializer<Error> {
+fn str_deserializer(s: &str) -> de::value::StrDeserializer<'_, Error> {
de::IntoDeserializer::into... | 1 | 1 | 1 |
f073bd40ee5a354e3e9e2ac376300368d28067fe | Ingvar Stepanyan | 2024-02-27T21:31:11 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 88fe36a..2911e24 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -260,7 +260,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.6.4"
+version = "0.6.5"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index 5b18544..9a... | 2 | 2 | 2 |
6281985127104650636a57d00b98ea50da41d1c8 | Léo Gaspard | 2024-02-27T21:29:26 | Fix map roundtrips in untagged enums (#64) | diff --git a/src/de.rs b/src/de.rs
index 9a1a75e..89be4ef 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -1,4 +1,4 @@
-use js_sys::{Array, ArrayBuffer, JsString, Number, Object, Symbol, Uint8Array};
+use js_sys::{Array, ArrayBuffer, JsString, Map, Number, Object, Symbol, Uint8Array};
use serde::de::value::{MapDeserializer,... | 2 | 32 | 3 |
b1b73aca91455f5449fda1a141ae821502a7bea5 | Ingvar Stepanyan | 2024-02-22T15:20:26 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index afe64f8..88fe36a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -260,7 +260,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.6.3"
+version = "0.6.4"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index e53473b..5b... | 2 | 2 | 2 |
03a470d6dc7f6a001113bd433e331e54e97846ca | Ingvar Stepanyan | 2024-02-22T15:17:39 | Add test for field aliases | diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 4004716..59e2380 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -873,3 +873,15 @@ fn serde_default_fields() {
// Check that it parses successfully despite the missing field.
let _struct: Struct = from_value(obj).unwrap();
}
+
+#[wasm... | 1 | 12 | 0 |
ff11d815905e01dbf5678cb05534733b8441d832 | Ingvar Stepanyan | 2024-02-22T15:12:59 | Revert "Use field indices for struct deserialization"
This reverts commit ce7669e1d175d999a733497e87152f55808ee8f2. | diff --git a/src/de.rs b/src/de.rs
index efae1d2..9a1a75e 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -65,7 +65,7 @@ impl<'de> de::MapAccess<'de> for MapAccess {
struct ObjectAccess {
obj: ObjectExt,
- fields: std::iter::Enumerate<std::slice::Iter<'static, &'static str>>,
+ fields: std::slice::Iter<'static,... | 1 | 10 | 13 |
e65f027ed7f80cb1fc6b32e9a28f41644faa6fda | Ingvar Stepanyan | 2023-12-10T17:37:25 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 169284d..afe64f8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -260,7 +260,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.6.2"
+version = "0.6.3"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index e6ab0b5..e5... | 2 | 2 | 2 |
0cf887939977d2025b23aafb67d04f8aafcc5761 | Ingvar Stepanyan | 2023-12-10T17:36:34 | Fix find-replace typo in docs | diff --git a/src/ser.rs b/src/ser.rs
index 708a651..e0096d9 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -425,7 +425,7 @@ impl<'s> ser::Serializer for &'s Serializer {
self.serialize_unit()
}
- /// For compatibility with serde-json, sserializes unit variants as "Variant" strings.
+ /// For compatib... | 2 | 10 | 10 |
ff836663437723bc86f5fe756ff876366f8a3084 | Ingvar Stepanyan | 2023-12-09T23:13:49 | Fix doc annotation | diff --git a/src/de.rs b/src/de.rs
index 064f77d..efae1d2 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -161,7 +161,7 @@ impl<'de> de::EnumAccess<'de> for EnumAccess {
}
}
-/// A newtype that allows using any [`JsValue`] as a [`deserializer`].
+/// A newtype that allows using any [`JsValue`] as a [`de::Deserializer... | 1 | 1 | 1 |
014e415d41b5511cf8ab29b972ff34c809455f93 | Ingvar Stepanyan | 2023-12-09T23:09:43 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 48f710e..169284d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -260,7 +260,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.6.1"
+version = "0.6.2"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index 91cdb75..e6... | 2 | 2 | 2 |
34aab01dcb5c3c035089f2c4d8f23264b154fc78 | Ingvar Stepanyan | 2023-12-09T23:04:04 | Use Wasm target for docs.rs | diff --git a/Cargo.toml b/Cargo.toml
index b9e8ea5..91cdb75 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,3 +44,6 @@ debug = true
[patch.crates-io]
proptest = { git = "https://github.com/RReverser/proptest", branch = "fix-wasm" }
+
+[package.metadata.docs.rs]
+targets = ["wasm32-unknown-unknown"] | 1 | 3 | 0 |
455d55645f94deaeda89656835ed4f91c55df4d5 | Ingvar Stepanyan | 2023-12-09T22:39:22 | More consistent docs + hide internal fields | diff --git a/src/de.rs b/src/de.rs
index ed35f73..064f77d 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -27,7 +27,7 @@ impl<'de> de::SeqAccess<'de> for SeqAccess {
}
}
-/// Provides [`serde::de::MapAccess`] from any JS iterator that returns `[key, value]` pairs.
+/// Provides [`de::MapAccess`] from any JS iterator ... | 3 | 67 | 16 |
ce7669e1d175d999a733497e87152f55808ee8f2 | Ingvar Stepanyan | 2023-12-09T20:01:55 | Use field indices for struct deserialization
Serde allows to deserialize fields in structs by returning an index instead of the name as a string.
This saves another 1.7% off benchmark size and speeds up CitmCatalog and twitter parsing benchmarks by 7-10%. | diff --git a/Cargo.toml b/Cargo.toml
index 56b063d..b9e8ea5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ categories = ["development-tools::ffi", "wasm", "encoding"]
keywords = ["serde", "serialization", "javascript", "wasm", "webassembly"]
[dependencies]
-serde = { version = "^1.0", features = ["deriv... | 2 | 14 | 11 |
a7e4c5b5aa540b0ae16509ccfd7d5e45a81536d6 | Ingvar Stepanyan | 2023-12-09T19:50:08 | Bump deps | diff --git a/Cargo.lock b/Cargo.lock
index 5a3bff3..48f710e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,15 +25,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
-version = "3.12.0"
+version = "3.14.0"
source = "registry+https://github.com/rust-lang... | 1 | 63 | 65 |
3dfe7271babd2834e36b5a3320ff4c807ce69813 | Ingvar Stepanyan | 2023-12-09T15:57:02 | Speed up integer decoding
Checking for `is_safe_integer` guarantees that the value is already a number, and then using `unchecked_into_f64` allows to avoid extra memory access cost of `Option<f64>`.
This speeds up CitmCatalog parsing benchmark by 15%. | diff --git a/src/de.rs b/src/de.rs
index dde47e2..98b07c2 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -245,10 +245,8 @@ impl Deserializer {
}
fn as_safe_integer(&self) -> Option<i64> {
- if let Some(v) = self.value.as_f64() {
- if Number::is_safe_integer(&self.value) {
- retur... | 1 | 2 | 4 |
68cf1a07e37eba35268eac817a373961c1de1e91 | Ingvar Stepanyan | 2023-10-25T15:47:11 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 7c145f6..5a3bff3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -263,7 +263,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.6.0"
+version = "0.6.1"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index cc8d4b6..29... | 2 | 2 | 2 |
43dad25dd4fdce37a9d47cf1276de5942626ba85 | Carl Sverre | 2023-10-06T01:55:11 | Fix using serde_bytes with an internally tagged enum (#58) | diff --git a/src/de.rs b/src/de.rs
index 06754b1..02b70d7 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -311,6 +311,10 @@ impl<'de> de::Deserializer<'de> for Deserializer {
visitor.visit_string(v)
} else if Array::is_array(&self.value) {
self.deserialize_seq(visitor)
+ } else if le... | 2 | 24 | 2 |
6181335775060e528e4c0945131c3a4889628c74 | Ingvar Stepanyan | 2023-09-13T17:44:26 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 1252903..7c145f6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -263,7 +263,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.5.0"
+version = "0.6.0"
dependencies = [
"bincode",
"getrandom",
diff --git a/Cargo.toml b/Cargo.toml
index c218d5c..cc... | 2 | 2 | 2 |
3a1d4e0e45537326c2a1226d62c1593cbda56f3a | jneem | 2023-09-04T14:21:26 | Add support for (de)serializing JsValues (#40)
Co-authored-by: Ingvar Stepanyan <me@rreverser.com> | diff --git a/Cargo.lock b/Cargo.lock
index 706f108..1252903 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,6 +8,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+[[package]]
+name = "bincode"
+versi... | 6 | 204 | 6 |
620cb3d3c36e59479753949b05aa93c29554cc3c | Bob Halley | 2023-03-06T20:17:00 | Calling deserialize_bytes() on an incompatible array should fail. (#45) | diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index c648853..434a343 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -493,6 +493,18 @@ fn bytes_as_array() {
assert_eq!(deserialized.as_ref(), src);
}
+#[wasm_bindgen_test]
+fn bytes_from_mixed_array() {
+ // The string "xyz" cannot conve... | 1 | 12 | 0 |
d80ab33f9fa91c136b71b532db0e047357869903 | Ingvar Stepanyan | 2023-03-06T12:29:55 | Update deps | diff --git a/Cargo.lock b/Cargo.lock
index ff4b794..706f108 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,9 +16,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
-version = "3.11.0"
+version = "3.12.0"
source = "registry+https://github.com/rust-lang/c... | 1 | 58 | 58 |
e91d8dfab803b92fc0acfe1e5ea21af329b9de6e | Ingvar Stepanyan | 2023-03-06T12:26:53 | chore: Release | diff --git a/Cargo.lock b/Cargo.lock
index 0a9335a..ff4b794 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -254,7 +254,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.4.6-alpha.0"
+version = "0.5.0"
dependencies = [
"getrandom",
"js-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 0b60... | 2 | 2 | 2 |
869a23e8cedf5bb22a8e337c7e39835d9560ca09 | Ingvar Stepanyan | 2022-12-29T21:51:13 | Don't benchmark msgpack by default | diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml
index ad410e2..a520f40 100644
--- a/benchmarks/Cargo.toml
+++ b/benchmarks/Cargo.toml
@@ -16,7 +16,7 @@ wasm-bindgen = { version = "^0.2" }
crate-type = ["cdylib", "rlib"]
[features]
-default = ["serde-json", "serde-wasm-bindgen", "msgpack"]
+default = ["se... | 1 | 1 | 1 |
0d3f5792c70267a1346039f242b6fd9a3af5bc95 | Ingvar Stepanyan | 2022-10-01T13:27:17 | (cargo-release) start next development iteration 0.4.6-alpha.0 | diff --git a/Cargo.lock b/Cargo.lock
index a73ebf1..645d018 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -226,7 +226,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.4.5"
+version = "0.4.6-alpha.0"
dependencies = [
"getrandom",
"js-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 12ae... | 2 | 2 | 2 |
5de284e727dcb91821d59518a02562077a366966 | Ingvar Stepanyan | 2022-10-01T13:26:20 | (cargo-release) version 0.4.5 | diff --git a/Cargo.lock b/Cargo.lock
index c2eca94..a73ebf1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -226,7 +226,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.4.5-alpha.0"
+version = "0.4.5"
dependencies = [
"getrandom",
"js-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 64db... | 2 | 2 | 2 |
2b927bff2f5900bd5632df6cc9e3452f9d98599f | Ingvar Stepanyan | 2022-10-01T13:26:01 | Forgot to update deps | diff --git a/Cargo.lock b/Cargo.lock
index 4fb0fe7..c2eca94 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -63,8 +63,9 @@ checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "js-sys"
-version = "0.3.59"
-source = "git+https://github.com/rustwasm/wasm-bindgen?rev=699e78811e2... | 2 | 19 | 15 |
f6cee31be65fffc680023dc39f0c5170261659bf | Ingvar Stepanyan | 2022-10-01T13:21:59 | (cargo-release) start next development iteration 0.4.5-alpha.0 | diff --git a/Cargo.lock b/Cargo.lock
index aadd800..4fb0fe7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -225,7 +225,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.4.4"
+version = "0.4.5-alpha.0"
dependencies = [
"getrandom",
"js-sys",
diff --git a/Cargo.toml b/Cargo.toml
index bf99... | 2 | 2 | 2 |
e0105ee7adcbdd08143ac5579a020f51e61b90e8 | Ingvar Stepanyan | 2022-10-01T13:20:06 | (cargo-release) version 0.4.4 | diff --git a/Cargo.lock b/Cargo.lock
index 57836c3..aadd800 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -225,7 +225,7 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
-version = "0.4.4-alpha.0"
+version = "0.4.4"
dependencies = [
"getrandom",
"js-sys",
diff --git a/Cargo.toml b/Cargo.toml
index c15e... | 2 | 2 | 2 |
f1bc251ffc970465d7ab4c85b8b7713f7aa62347 | Ingvar Stepanyan | 2022-09-08T01:33:08 | Simplify is_nullish | diff --git a/src/de.rs b/src/de.rs
index 808cc61..6322045 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -164,7 +164,7 @@ impl Deserializer {
}
fn is_nullish(&self) -> bool {
- self.value.is_null() || self.value.is_undefined()
+ self.value.loose_eq(&JsValue::NULL)
}
fn as_bytes(&self) -... | 1 | 1 | 1 |
0e24186dd1637eb3f2924d9328b656b639b77125 | Ingvar Stepanyan | 2022-09-07T23:13:54 | Enable u128/i128 -> bigint unconditionally
It doesn't make much sense to put them in the same box with u64/i64 and not have default representation at all. | diff --git a/src/ser.rs b/src/ser.rs
index 4491519..73557cf 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -338,19 +338,11 @@ impl<'s> ser::Serializer for &'s Serializer {
}
fn serialize_i128(self, v: i128) -> Result {
- if self.serialize_large_number_types_as_bigints {
- Ok(JsValue::from(v))... | 2 | 7 | 15 |
97506f0058f2e37f5353532525585db41e2c7fa9 | Ingvar Stepanyan | 2022-09-07T22:06:03 | js_sys::Error::new -> JsError::new | diff --git a/src/error.rs b/src/error.rs
index 729f9f0..50fcd1c 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -21,7 +21,7 @@ impl std::error::Error for Error {}
impl Error {
/// Creates a JavaScript `Error` with a given message.
pub fn new<T: std::fmt::Display>(msg: T) -> Self {
- Error(js_sys::Erro... | 1 | 1 | 1 |
3920a867e0bd2d47f485b7da8aff2fb1d0f43ae4 | Ingvar Stepanyan | 2022-09-04T13:38:33 | Prepare for next wasm-bindgen release
Large bigint conversions were upstreamed in #3058. | diff --git a/Cargo.lock b/Cargo.lock
index d91e5e6..57836c3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -64,8 +64,7 @@ checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "js-sys"
version = "0.3.59"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checks... | 6 | 41 | 75 |
9123aaf6a8a78aa0cd7b8d7833f8a55759d04135 | Ingvar Stepanyan | 2022-09-04T12:03:36 | Use safe integer constants from js_sys::Number | diff --git a/src/ser.rs b/src/ser.rs
index c8e9acd..4491519 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -1,4 +1,4 @@
-use js_sys::{Array, JsString, Map, Object, Uint8Array};
+use js_sys::{Array, JsString, Map, Number, Object, Uint8Array};
use serde::ser::{self, Error as _, Serialize};
use wasm_bindgen::prelude::*;
u... | 2 | 12 | 14 |
1ba4137d4e0f7e497c68cb695973cd60620d6e62 | Ingvar Stepanyan | 2022-09-02T01:16:37 | Implement full i128 and u128 support | diff --git a/src/de.rs b/src/de.rs
index a1f1486..5feb1e9 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -1,8 +1,7 @@
use crate::bindings;
use js_sys::{Array, ArrayBuffer, BigInt, JsString, Number, Object, Symbol, Uint8Array};
use serde::de::value::{MapDeserializer, SeqDeserializer};
-use serde::de::IntoDeserializer;
-us... | 2 | 64 | 24 |
3423a9807d1af0318b940eb9341a6c5e31e5b8c3 | Ingvar Stepanyan | 2022-09-02T00:49:59 | Update deps
Update deps and fix tests after https://github.com/rustwasm/wasm-bindgen/pull/2978. | diff --git a/Cargo.lock b/Cargo.lock
index cdda517..d91e5e6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,9 +16,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
-version = "3.7.0"
+version = "3.11.0"
source = "registry+https://github.com/rust-lang/cr... | 2 | 71 | 71 |
58008f5c6e3b6c6907cb8318bf37c17c7b11441f | Ingvar Stepanyan | 2022-09-01T23:58:14 | Add usize/isize compat tests | diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index b68bc72..4f46294 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -263,29 +263,31 @@ mod compat {
}
macro_rules! test_bigint_boundaries {
+ ($ty:ident) => {
+ test_primitive_with_config($ty::MIN, &BIGINT_SERIALIZER);... | 1 | 38 | 14 |
151745327c13de2fdeb30e8a7c7541bcb66f4b3b | Ingvar Stepanyan | 2022-09-01T15:34:22 | Switch to JsValue intrinsics for i64 -> JsValue
As of rustwasm/wasm-bindgen#3049 the builtin conversions no longer use strings, but pass numbers directly, so our custom intrinsic is no longer necessary. | diff --git a/src/bindings.rs b/src/bindings.rs
index cf79a48..f1df00d 100644
--- a/src/bindings.rs
+++ b/src/bindings.rs
@@ -8,10 +8,4 @@ extern "C" {
#[wasm_bindgen(js_name = BigInt)]
pub fn bigint_to_i64(x: &BigInt) -> i64;
-
- #[wasm_bindgen(js_name = BigInt)]
- pub fn bigint_from_u64(x: u64) -> Bi... | 3 | 4 | 11 |
0d5a3ec5f39505b722a38a8d27a07eb22b1ae159 | Ingvar Stepanyan | 2022-09-01T15:26:34 | Enhance tests with proptest | diff --git a/Cargo.toml b/Cargo.toml
index 45be979..4a82dbf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,18 @@ serde_bytes = "0.11.1"
serde_json = "1.0.39"
maplit = "1.0.2"
+[dev-dependencies.proptest]
+version = "1.0"
+# The default feature set includes things like process forking which are not
+# support... | 5 | 418 | 281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.