std: Camel case some constructors
This commit is contained in:
parent
6c5c835a1d
commit
aab4d6b8d7
23 changed files with 85 additions and 86 deletions
|
@ -10,13 +10,13 @@ import unsafe::{SharedMutableState, shared_mutable_state,
|
||||||
clone_shared_mutable_state, unwrap_shared_mutable_state,
|
clone_shared_mutable_state, unwrap_shared_mutable_state,
|
||||||
get_shared_mutable_state, get_shared_immutable_state};
|
get_shared_mutable_state, get_shared_immutable_state};
|
||||||
import sync;
|
import sync;
|
||||||
import sync::{Mutex, mutex, mutex_with_condvars,
|
import sync::{Mutex, mutex_with_condvars,
|
||||||
RWlock, rwlock, rwlock_with_condvars};
|
RWlock, rwlock_with_condvars};
|
||||||
|
|
||||||
export ARC, arc, clone, get;
|
export ARC, clone, get;
|
||||||
export Condvar;
|
export Condvar;
|
||||||
export MutexARC, mutex_arc, mutex_arc_with_condvars, unwrap_mutex_arc;
|
export MutexARC, mutex_arc_with_condvars, unwrap_mutex_arc;
|
||||||
export RWARC, rw_arc, rw_arc_with_condvars, RWWriteMode, RWReadMode;
|
export RWARC, rw_arc_with_condvars, RWWriteMode, RWReadMode;
|
||||||
export unwrap_rw_arc;
|
export unwrap_rw_arc;
|
||||||
|
|
||||||
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
|
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
|
||||||
|
@ -73,7 +73,7 @@ impl &Condvar {
|
||||||
struct ARC<T: const send> { x: SharedMutableState<T>; }
|
struct ARC<T: const send> { x: SharedMutableState<T>; }
|
||||||
|
|
||||||
/// Create an atomically reference counted wrapper.
|
/// Create an atomically reference counted wrapper.
|
||||||
fn arc<T: const send>(+data: T) -> ARC<T> {
|
fn ARC<T: const send>(+data: T) -> ARC<T> {
|
||||||
ARC { x: unsafe { shared_mutable_state(data) } }
|
ARC { x: unsafe { shared_mutable_state(data) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ struct MutexARCInner<T: send> { lock: Mutex; failed: bool; data: T; }
|
||||||
struct MutexARC<T: send> { x: SharedMutableState<MutexARCInner<T>>; }
|
struct MutexARC<T: send> { x: SharedMutableState<MutexARCInner<T>>; }
|
||||||
|
|
||||||
/// Create a mutex-protected ARC with the supplied data.
|
/// Create a mutex-protected ARC with the supplied data.
|
||||||
fn mutex_arc<T: send>(+user_data: T) -> MutexARC<T> {
|
fn MutexARC<T: send>(+user_data: T) -> MutexARC<T> {
|
||||||
mutex_arc_with_condvars(user_data, 1)
|
mutex_arc_with_condvars(user_data, 1)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ struct RWARC<T: const send> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a reader/writer ARC with the supplied data.
|
/// Create a reader/writer ARC with the supplied data.
|
||||||
fn rw_arc<T: const send>(+user_data: T) -> RWARC<T> {
|
fn RWARC<T: const send>(+user_data: T) -> RWARC<T> {
|
||||||
rw_arc_with_condvars(user_data, 1)
|
rw_arc_with_condvars(user_data, 1)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -445,7 +445,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn manually_share_arc() {
|
fn manually_share_arc() {
|
||||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = arc::arc(v);
|
let arc_v = arc::ARC(v);
|
||||||
|
|
||||||
let (c, p) = pipes::stream();
|
let (c, p) = pipes::stream();
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutex_arc_condvar() {
|
fn test_mutex_arc_condvar() {
|
||||||
let arc = ~mutex_arc(false);
|
let arc = ~MutexARC(false);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
let (c,p) = pipes::oneshot();
|
let (c,p) = pipes::oneshot();
|
||||||
let (c,p) = (~mut Some(c), ~mut Some(p));
|
let (c,p) = (~mut Some(c), ~mut Some(p));
|
||||||
|
@ -491,7 +491,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_arc_condvar_poison() {
|
fn test_arc_condvar_poison() {
|
||||||
let arc = ~mutex_arc(1);
|
let arc = ~MutexARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
let (c,p) = pipes::stream();
|
let (c,p) = pipes::stream();
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_mutex_arc_poison() {
|
fn test_mutex_arc_poison() {
|
||||||
let arc = ~mutex_arc(1);
|
let arc = ~MutexARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.access |one| {
|
do arc2.access |one| {
|
||||||
|
@ -525,7 +525,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_mutex_arc_unwrap_poison() {
|
fn test_mutex_arc_unwrap_poison() {
|
||||||
let arc = mutex_arc(1);
|
let arc = MutexARC(1);
|
||||||
let arc2 = ~(&arc).clone();
|
let arc2 = ~(&arc).clone();
|
||||||
let (c,p) = pipes::stream();
|
let (c,p) = pipes::stream();
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
|
@ -540,7 +540,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_poison_wr() {
|
fn test_rw_arc_poison_wr() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.write |one| {
|
do arc2.write |one| {
|
||||||
|
@ -553,7 +553,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_poison_ww() {
|
fn test_rw_arc_poison_ww() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.write |one| {
|
do arc2.write |one| {
|
||||||
|
@ -566,7 +566,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_poison_dw() {
|
fn test_rw_arc_poison_dw() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.write_downgrade |write_mode| {
|
do arc2.write_downgrade |write_mode| {
|
||||||
|
@ -581,7 +581,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[ignore(cfg(windows))]
|
#[test] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_no_poison_rr() {
|
fn test_rw_arc_no_poison_rr() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.read |one| {
|
do arc2.read |one| {
|
||||||
|
@ -594,7 +594,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[ignore(cfg(windows))]
|
#[test] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_no_poison_rw() {
|
fn test_rw_arc_no_poison_rw() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.read |one| {
|
do arc2.read |one| {
|
||||||
|
@ -607,7 +607,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[ignore(cfg(windows))]
|
#[test] #[ignore(cfg(windows))]
|
||||||
fn test_rw_arc_no_poison_dr() {
|
fn test_rw_arc_no_poison_dr() {
|
||||||
let arc = ~rw_arc(1);
|
let arc = ~RWARC(1);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do arc2.write_downgrade |write_mode| {
|
do arc2.write_downgrade |write_mode| {
|
||||||
|
@ -623,7 +623,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rw_arc() {
|
fn test_rw_arc() {
|
||||||
let arc = ~rw_arc(0);
|
let arc = ~RWARC(0);
|
||||||
let arc2 = ~arc.clone();
|
let arc2 = ~arc.clone();
|
||||||
let (c,p) = pipes::stream();
|
let (c,p) = pipes::stream();
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ mod tests {
|
||||||
// (4) tells writer and all other readers to contend as it downgrades.
|
// (4) tells writer and all other readers to contend as it downgrades.
|
||||||
// (5) Writer attempts to set state back to 42, while downgraded task
|
// (5) Writer attempts to set state back to 42, while downgraded task
|
||||||
// and all reader tasks assert that it's 31337.
|
// and all reader tasks assert that it's 31337.
|
||||||
let arc = ~rw_arc(0);
|
let arc = ~RWARC(0);
|
||||||
|
|
||||||
// Reader tasks
|
// Reader tasks
|
||||||
let mut reader_convos = ~[];
|
let mut reader_convos = ~[];
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export CVec;
|
export CVec;
|
||||||
export c_vec, c_vec_with_dtor;
|
export CVec, c_vec_with_dtor;
|
||||||
export get, set;
|
export get, set;
|
||||||
export len;
|
export len;
|
||||||
export ptr;
|
export ptr;
|
||||||
|
@ -66,7 +66,7 @@ struct DtorRes {
|
||||||
* * base - A foreign pointer to a buffer
|
* * base - A foreign pointer to a buffer
|
||||||
* * len - The number of elements in the buffer
|
* * len - The number of elements in the buffer
|
||||||
*/
|
*/
|
||||||
unsafe fn c_vec<T>(base: *mut T, len: uint) -> CVec<T> {
|
unsafe fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
|
||||||
return CVecCtor({
|
return CVecCtor({
|
||||||
base: base,
|
base: base,
|
||||||
len: len,
|
len: len,
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
import core::Option;
|
import core::Option;
|
||||||
import option::{Some, None};
|
import option::{Some, None};
|
||||||
|
|
||||||
export doc;
|
|
||||||
export Doc;
|
export Doc;
|
||||||
export doc_at;
|
export doc_at;
|
||||||
export maybe_get_doc;
|
export maybe_get_doc;
|
||||||
|
@ -75,7 +74,7 @@ fn vuint_at(data: &[u8], start: uint) -> {val: uint, next: uint} {
|
||||||
} else { error!("vint too big"); fail; }
|
} else { error!("vint too big"); fail; }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn doc(data: @~[u8]) -> Doc {
|
fn Doc(data: @~[u8]) -> Doc {
|
||||||
return {data: data, start: 0u, end: vec::len::<u8>(*data)};
|
return {data: data, start: 0u, end: vec::len::<u8>(*data)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +618,7 @@ fn test_option_int() {
|
||||||
let mbuf = io::mem_buffer();
|
let mbuf = io::mem_buffer();
|
||||||
let ebml_w = ebml::Writer(io::mem_buffer_writer(mbuf));
|
let ebml_w = ebml::Writer(io::mem_buffer_writer(mbuf));
|
||||||
serialize_0(ebml_w, v);
|
serialize_0(ebml_w, v);
|
||||||
let ebml_doc = ebml::doc(@io::mem_buffer_buf(mbuf));
|
let ebml_doc = ebml::Doc(@io::mem_buffer_buf(mbuf));
|
||||||
let deser = ebml_deserializer(ebml_doc);
|
let deser = ebml_deserializer(ebml_doc);
|
||||||
let v1 = deserialize_0(deser);
|
let v1 = deserialize_0(deser);
|
||||||
debug!("v1 == %?", v1);
|
debug!("v1 == %?", v1);
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* in std.
|
* in std.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export Condvar, Semaphore, Mutex, mutex, mutex_with_condvars;
|
export Condvar, Semaphore, Mutex, mutex_with_condvars;
|
||||||
export RWlock, rwlock, rwlock_with_condvars, RWlockReadMode, RWlockWriteMode;
|
export RWlock, rwlock_with_condvars, RWlockReadMode, RWlockWriteMode;
|
||||||
|
|
||||||
import unsafe::{Exclusive, exclusive};
|
import unsafe::{Exclusive, exclusive};
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ impl &Semaphore {
|
||||||
struct Mutex { priv sem: Sem<~[mut Waitqueue]>; }
|
struct Mutex { priv sem: Sem<~[mut Waitqueue]>; }
|
||||||
|
|
||||||
/// Create a new mutex, with one associated condvar.
|
/// Create a new mutex, with one associated condvar.
|
||||||
fn mutex() -> Mutex { mutex_with_condvars(1) }
|
fn Mutex() -> Mutex { mutex_with_condvars(1) }
|
||||||
/**
|
/**
|
||||||
* Create a new mutex, with a specified number of associated condvars. This
|
* Create a new mutex, with a specified number of associated condvars. This
|
||||||
* will allow calling wait_on/signal_on/broadcast_on with condvar IDs between
|
* will allow calling wait_on/signal_on/broadcast_on with condvar IDs between
|
||||||
|
@ -412,7 +412,7 @@ struct RWlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new rwlock, with one associated condvar.
|
/// Create a new rwlock, with one associated condvar.
|
||||||
fn rwlock() -> RWlock { rwlock_with_condvars(1) }
|
fn RWlock() -> RWlock { rwlock_with_condvars(1) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new rwlock, with a specified number of associated condvars.
|
* Create a new rwlock, with a specified number of associated condvars.
|
||||||
|
@ -745,7 +745,7 @@ mod tests {
|
||||||
// Unsafely achieve shared state, and do the textbook
|
// Unsafely achieve shared state, and do the textbook
|
||||||
// "load tmp <- ptr; inc tmp; store ptr <- tmp" dance.
|
// "load tmp <- ptr; inc tmp; store ptr <- tmp" dance.
|
||||||
let (c,p) = pipes::stream();
|
let (c,p) = pipes::stream();
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
let sharedstate = ~0;
|
let sharedstate = ~0;
|
||||||
let ptr = ptr::addr_of(*sharedstate);
|
let ptr = ptr::addr_of(*sharedstate);
|
||||||
|
@ -773,7 +773,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutex_cond_wait() {
|
fn test_mutex_cond_wait() {
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
|
|
||||||
// Child wakes up parent
|
// Child wakes up parent
|
||||||
do m.lock_cond |cond| {
|
do m.lock_cond |cond| {
|
||||||
|
@ -805,7 +805,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn test_mutex_cond_broadcast_helper(num_waiters: uint) {
|
fn test_mutex_cond_broadcast_helper(num_waiters: uint) {
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let mut ports = ~[];
|
let mut ports = ~[];
|
||||||
|
|
||||||
for num_waiters.times {
|
for num_waiters.times {
|
||||||
|
@ -840,7 +840,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutex_cond_no_waiter() {
|
fn test_mutex_cond_no_waiter() {
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
do task::try {
|
do task::try {
|
||||||
do m.lock_cond |_x| { }
|
do m.lock_cond |_x| { }
|
||||||
|
@ -852,7 +852,7 @@ mod tests {
|
||||||
#[test] #[ignore(cfg(windows))]
|
#[test] #[ignore(cfg(windows))]
|
||||||
fn test_mutex_killed_simple() {
|
fn test_mutex_killed_simple() {
|
||||||
// Mutex must get automatically unlocked if failed/killed within.
|
// Mutex must get automatically unlocked if failed/killed within.
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
|
|
||||||
let result: result::Result<(),()> = do task::try {
|
let result: result::Result<(),()> = do task::try {
|
||||||
|
@ -868,7 +868,7 @@ mod tests {
|
||||||
fn test_mutex_killed_cond() {
|
fn test_mutex_killed_cond() {
|
||||||
// Getting killed during cond wait must not corrupt the mutex while
|
// Getting killed during cond wait must not corrupt the mutex while
|
||||||
// unwinding (e.g. double unlock).
|
// unwinding (e.g. double unlock).
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
|
|
||||||
let result: result::Result<(),()> = do task::try {
|
let result: result::Result<(),()> = do task::try {
|
||||||
|
@ -892,7 +892,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test] #[ignore(cfg(windows))]
|
#[test] #[ignore(cfg(windows))]
|
||||||
fn test_mutex_killed_broadcast() {
|
fn test_mutex_killed_broadcast() {
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
let (c,p) = pipes::stream();
|
let (c,p) = pipes::stream();
|
||||||
|
|
||||||
|
@ -936,7 +936,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mutex_cond_signal_on_0() {
|
fn test_mutex_cond_signal_on_0() {
|
||||||
// Tests that signal_on(0) is equivalent to signal().
|
// Tests that signal_on(0) is equivalent to signal().
|
||||||
let m = ~mutex();
|
let m = ~Mutex();
|
||||||
do m.lock_cond |cond| {
|
do m.lock_cond |cond| {
|
||||||
let m2 = ~m.clone();
|
let m2 = ~m.clone();
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
|
@ -1040,17 +1040,17 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_readers_wont_modify_the_data() {
|
fn test_rwlock_readers_wont_modify_the_data() {
|
||||||
test_rwlock_exclusion(~rwlock(), Read, Write);
|
test_rwlock_exclusion(~RWlock(), Read, Write);
|
||||||
test_rwlock_exclusion(~rwlock(), Write, Read);
|
test_rwlock_exclusion(~RWlock(), Write, Read);
|
||||||
test_rwlock_exclusion(~rwlock(), Read, Downgrade);
|
test_rwlock_exclusion(~RWlock(), Read, Downgrade);
|
||||||
test_rwlock_exclusion(~rwlock(), Downgrade, Read);
|
test_rwlock_exclusion(~RWlock(), Downgrade, Read);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_writers_and_writers() {
|
fn test_rwlock_writers_and_writers() {
|
||||||
test_rwlock_exclusion(~rwlock(), Write, Write);
|
test_rwlock_exclusion(~RWlock(), Write, Write);
|
||||||
test_rwlock_exclusion(~rwlock(), Write, Downgrade);
|
test_rwlock_exclusion(~RWlock(), Write, Downgrade);
|
||||||
test_rwlock_exclusion(~rwlock(), Downgrade, Write);
|
test_rwlock_exclusion(~RWlock(), Downgrade, Write);
|
||||||
test_rwlock_exclusion(~rwlock(), Downgrade, Downgrade);
|
test_rwlock_exclusion(~RWlock(), Downgrade, Downgrade);
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn test_rwlock_handshake(+x: ~RWlock, mode1: RWlockMode,
|
fn test_rwlock_handshake(+x: ~RWlock, mode1: RWlockMode,
|
||||||
|
@ -1084,32 +1084,32 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_readers_and_readers() {
|
fn test_rwlock_readers_and_readers() {
|
||||||
test_rwlock_handshake(~rwlock(), Read, Read, false);
|
test_rwlock_handshake(~RWlock(), Read, Read, false);
|
||||||
// The downgrader needs to get in before the reader gets in, otherwise
|
// The downgrader needs to get in before the reader gets in, otherwise
|
||||||
// they cannot end up reading at the same time.
|
// they cannot end up reading at the same time.
|
||||||
test_rwlock_handshake(~rwlock(), DowngradeRead, Read, false);
|
test_rwlock_handshake(~RWlock(), DowngradeRead, Read, false);
|
||||||
test_rwlock_handshake(~rwlock(), Read, DowngradeRead, true);
|
test_rwlock_handshake(~RWlock(), Read, DowngradeRead, true);
|
||||||
// Two downgrade_reads can never both end up reading at the same time.
|
// Two downgrade_reads can never both end up reading at the same time.
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_downgrade_unlock() {
|
fn test_rwlock_downgrade_unlock() {
|
||||||
// Tests that downgrade can unlock the lock in both modes
|
// Tests that downgrade can unlock the lock in both modes
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
do lock_rwlock_in_mode(x, Downgrade) { }
|
do lock_rwlock_in_mode(x, Downgrade) { }
|
||||||
test_rwlock_handshake(x, Read, Read, false);
|
test_rwlock_handshake(x, Read, Read, false);
|
||||||
let y = ~rwlock();
|
let y = ~RWlock();
|
||||||
do lock_rwlock_in_mode(y, DowngradeRead) { }
|
do lock_rwlock_in_mode(y, DowngradeRead) { }
|
||||||
test_rwlock_exclusion(y, Write, Write);
|
test_rwlock_exclusion(y, Write, Write);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_read_recursive() {
|
fn test_rwlock_read_recursive() {
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
do x.read { do x.read { } }
|
do x.read { do x.read { } }
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rwlock_cond_wait() {
|
fn test_rwlock_cond_wait() {
|
||||||
// As test_mutex_cond_wait above.
|
// As test_mutex_cond_wait above.
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
|
|
||||||
// Child wakes up parent
|
// Child wakes up parent
|
||||||
do x.write_cond |cond| {
|
do x.write_cond |cond| {
|
||||||
|
@ -1154,7 +1154,7 @@ mod tests {
|
||||||
x.write_cond(blk)
|
x.write_cond(blk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
let mut ports = ~[];
|
let mut ports = ~[];
|
||||||
|
|
||||||
for num_waiters.times {
|
for num_waiters.times {
|
||||||
|
@ -1193,7 +1193,7 @@ mod tests {
|
||||||
#[cfg(test)] #[ignore(cfg(windows))]
|
#[cfg(test)] #[ignore(cfg(windows))]
|
||||||
fn rwlock_kill_helper(mode1: RWlockMode, mode2: RWlockMode) {
|
fn rwlock_kill_helper(mode1: RWlockMode, mode2: RWlockMode) {
|
||||||
// Mutex must get automatically unlocked if failed/killed within.
|
// Mutex must get automatically unlocked if failed/killed within.
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
let x2 = ~x.clone();
|
let x2 = ~x.clone();
|
||||||
|
|
||||||
let result: result::Result<(),()> = do task::try {
|
let result: result::Result<(),()> = do task::try {
|
||||||
|
@ -1231,8 +1231,8 @@ mod tests {
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_rwlock_downgrade_cant_swap() {
|
fn test_rwlock_downgrade_cant_swap() {
|
||||||
// Tests that you can't downgrade with a different rwlock's token.
|
// Tests that you can't downgrade with a different rwlock's token.
|
||||||
let x = ~rwlock();
|
let x = ~RWlock();
|
||||||
let y = ~rwlock();
|
let y = ~RWlock();
|
||||||
do x.write_downgrade |xwrite| {
|
do x.write_downgrade |xwrite| {
|
||||||
let mut xopt = Some(xwrite);
|
let mut xopt = Some(xwrite);
|
||||||
do y.write_downgrade |_ywrite| {
|
do y.write_downgrade |_ywrite| {
|
||||||
|
|
|
@ -136,7 +136,7 @@ fn get_field_type(tcx: ty::ctxt, class_id: ast::def_id,
|
||||||
def: ast::def_id) -> ty::ty_param_bounds_and_ty {
|
def: ast::def_id) -> ty::ty_param_bounds_and_ty {
|
||||||
let cstore = tcx.cstore;
|
let cstore = tcx.cstore;
|
||||||
let cdata = cstore::get_crate_data(cstore, class_id.crate);
|
let cdata = cstore::get_crate_data(cstore, class_id.crate);
|
||||||
let all_items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
|
let all_items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
|
||||||
debug!("Looking up %?", class_id);
|
debug!("Looking up %?", class_id);
|
||||||
let class_doc = expect(tcx.diag,
|
let class_doc = expect(tcx.diag,
|
||||||
decoder::maybe_find_item(class_id.node, all_items),
|
decoder::maybe_find_item(class_id.node, all_items),
|
||||||
|
|
|
@ -98,7 +98,7 @@ fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc {
|
||||||
// Looks up an item in the given metadata and returns an ebml doc pointing
|
// Looks up an item in the given metadata and returns an ebml doc pointing
|
||||||
// to the item data.
|
// to the item data.
|
||||||
fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc {
|
fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc {
|
||||||
let items = ebml::get_doc(ebml::doc(data), tag_items);
|
let items = ebml::get_doc(ebml::Doc(data), tag_items);
|
||||||
match maybe_find_item(item_id, items) {
|
match maybe_find_item(item_id, items) {
|
||||||
None => fail(fmt!("lookup_item: id not found: %d", item_id)),
|
None => fail(fmt!("lookup_item: id not found: %d", item_id)),
|
||||||
Some(d) => d
|
Some(d) => d
|
||||||
|
@ -362,7 +362,7 @@ fn get_impl_traits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) -> ~[ty::t] {
|
||||||
|
|
||||||
fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
name: ast::ident) -> ast::def_id {
|
name: ast::ident) -> ast::def_id {
|
||||||
let items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
|
let items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
|
||||||
let mut found = None;
|
let mut found = None;
|
||||||
for ebml::tagged_docs(find_item(id, items), tag_item_impl_method) |mid| {
|
for ebml::tagged_docs(find_item(id, items), tag_item_impl_method) |mid| {
|
||||||
let m_did = ebml::with_doc_data(mid, |d| parse_def_id(d));
|
let m_did = ebml::with_doc_data(mid, |d| parse_def_id(d));
|
||||||
|
@ -375,7 +375,7 @@ fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
|
|
||||||
fn get_class_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
fn get_class_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
name: ast::ident) -> ast::def_id {
|
name: ast::ident) -> ast::def_id {
|
||||||
let items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
|
let items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
|
||||||
let mut found = None;
|
let mut found = None;
|
||||||
let cls_items = match maybe_find_item(id, items) {
|
let cls_items = match maybe_find_item(id, items) {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
|
@ -396,7 +396,7 @@ fn get_class_method(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn class_dtor(cdata: cmd, id: ast::node_id) -> Option<ast::def_id> {
|
fn class_dtor(cdata: cmd, id: ast::node_id) -> Option<ast::def_id> {
|
||||||
let items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
|
let items = ebml::get_doc(ebml::Doc(cdata.data), tag_items);
|
||||||
let mut found = None;
|
let mut found = None;
|
||||||
let cls_items = match maybe_find_item(id, items) {
|
let cls_items = match maybe_find_item(id, items) {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
|
@ -445,7 +445,7 @@ struct path_entry {
|
||||||
|
|
||||||
/// Iterates over all the paths in the given crate.
|
/// Iterates over all the paths in the given crate.
|
||||||
fn each_path(intr: ident_interner, cdata: cmd, f: fn(path_entry) -> bool) {
|
fn each_path(intr: ident_interner, cdata: cmd, f: fn(path_entry) -> bool) {
|
||||||
let root = ebml::doc(cdata.data);
|
let root = ebml::Doc(cdata.data);
|
||||||
let items = ebml::get_doc(root, tag_items);
|
let items = ebml::get_doc(root, tag_items);
|
||||||
let items_data = ebml::get_doc(items, tag_items_data);
|
let items_data = ebml::get_doc(items, tag_items_data);
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ fn maybe_get_item_ast(intr: ident_interner, cdata: cmd, tcx: ty::ctxt,
|
||||||
fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
fn get_enum_variants(intr: ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
tcx: ty::ctxt) -> ~[ty::variant_info] {
|
tcx: ty::ctxt) -> ~[ty::variant_info] {
|
||||||
let data = cdata.data;
|
let data = cdata.data;
|
||||||
let items = ebml::get_doc(ebml::doc(data), tag_items);
|
let items = ebml::get_doc(ebml::Doc(data), tag_items);
|
||||||
let item = find_item(id, items);
|
let item = find_item(id, items);
|
||||||
let mut infos: ~[ty::variant_info] = ~[];
|
let mut infos: ~[ty::variant_info] = ~[];
|
||||||
let variant_ids = enum_variant_ids(item, cdata);
|
let variant_ids = enum_variant_ids(item, cdata);
|
||||||
|
@ -888,7 +888,7 @@ fn list_crate_attributes(intr: ident_interner, md: ebml::Doc, hash: ~str,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_crate_attributes(data: @~[u8]) -> ~[ast::attribute] {
|
fn get_crate_attributes(data: @~[u8]) -> ~[ast::attribute] {
|
||||||
return get_attributes(ebml::doc(data));
|
return get_attributes(ebml::Doc(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
type crate_dep = {cnum: ast::crate_num, name: ast::ident,
|
type crate_dep = {cnum: ast::crate_num, name: ast::ident,
|
||||||
|
@ -896,7 +896,7 @@ type crate_dep = {cnum: ast::crate_num, name: ast::ident,
|
||||||
|
|
||||||
fn get_crate_deps(intr: ident_interner, data: @~[u8]) -> ~[crate_dep] {
|
fn get_crate_deps(intr: ident_interner, data: @~[u8]) -> ~[crate_dep] {
|
||||||
let mut deps: ~[crate_dep] = ~[];
|
let mut deps: ~[crate_dep] = ~[];
|
||||||
let cratedoc = ebml::doc(data);
|
let cratedoc = ebml::Doc(data);
|
||||||
let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps);
|
let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps);
|
||||||
let mut crate_num = 1;
|
let mut crate_num = 1;
|
||||||
fn docstr(doc: ebml::Doc, tag_: uint) -> ~str {
|
fn docstr(doc: ebml::Doc, tag_: uint) -> ~str {
|
||||||
|
@ -925,7 +925,7 @@ fn list_crate_deps(intr: ident_interner, data: @~[u8], out: io::Writer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_crate_hash(data: @~[u8]) -> ~str {
|
fn get_crate_hash(data: @~[u8]) -> ~str {
|
||||||
let cratedoc = ebml::doc(data);
|
let cratedoc = ebml::Doc(data);
|
||||||
let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash);
|
let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash);
|
||||||
return str::from_bytes(ebml::doc_data(hashdoc));
|
return str::from_bytes(ebml::doc_data(hashdoc));
|
||||||
}
|
}
|
||||||
|
@ -981,7 +981,7 @@ fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
|
||||||
fn list_crate_metadata(intr: ident_interner, bytes: @~[u8],
|
fn list_crate_metadata(intr: ident_interner, bytes: @~[u8],
|
||||||
out: io::Writer) {
|
out: io::Writer) {
|
||||||
let hash = get_crate_hash(bytes);
|
let hash = get_crate_hash(bytes);
|
||||||
let md = ebml::doc(bytes);
|
let md = ebml::Doc(bytes);
|
||||||
list_crate_attributes(intr, md, hash, out);
|
list_crate_attributes(intr, md, hash, out);
|
||||||
list_crate_deps(intr, bytes, out);
|
list_crate_deps(intr, bytes, out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -939,7 +939,7 @@ fn roundtrip(in_item: @ast::item) {
|
||||||
let mbuf = io::mem_buffer();
|
let mbuf = io::mem_buffer();
|
||||||
let ebml_w = ebml::Writer(io::mem_buffer_writer(mbuf));
|
let ebml_w = ebml::Writer(io::mem_buffer_writer(mbuf));
|
||||||
encode_item_ast(ebml_w, in_item);
|
encode_item_ast(ebml_w, in_item);
|
||||||
let ebml_doc = ebml::doc(@io::mem_buffer_buf(mbuf));
|
let ebml_doc = ebml::Doc(@io::mem_buffer_buf(mbuf));
|
||||||
let out_item = decode_item_ast(ebml_doc);
|
let out_item = decode_item_ast(ebml_doc);
|
||||||
|
|
||||||
let exp_str =
|
let exp_str =
|
||||||
|
|
|
@ -241,7 +241,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
|
||||||
i += 1u;
|
i += 1u;
|
||||||
let old_len = colors.len();
|
let old_len = colors.len();
|
||||||
|
|
||||||
let color = arc::arc(colors);
|
let color = arc::ARC(colors);
|
||||||
|
|
||||||
colors = do par::mapi_factory(*arc::get(&color)) {
|
colors = do par::mapi_factory(*arc::get(&color)) {
|
||||||
let colors = arc::clone(&color);
|
let colors = arc::clone(&color);
|
||||||
|
@ -414,7 +414,7 @@ fn main(args: ~[~str]) {
|
||||||
let mut total_seq = 0.0;
|
let mut total_seq = 0.0;
|
||||||
let mut total_par = 0.0;
|
let mut total_par = 0.0;
|
||||||
|
|
||||||
let graph_arc = arc::arc(copy graph);
|
let graph_arc = arc::ARC(copy graph);
|
||||||
|
|
||||||
do gen_search_keys(graph, num_keys).map() |root| {
|
do gen_search_keys(graph, num_keys).map() |root| {
|
||||||
io::stdout().write_line(~"");
|
io::stdout().write_line(~"");
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn recv(p: &pipe) -> uint {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init() -> (pipe,pipe) {
|
fn init() -> (pipe,pipe) {
|
||||||
let m = arc::mutex_arc(~[]);
|
let m = arc::MutexARC(~[]);
|
||||||
((&m).clone(), m)
|
((&m).clone(), m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn recv(p: &pipe) -> uint {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init() -> (pipe,pipe) {
|
fn init() -> (pipe,pipe) {
|
||||||
let x = arc::rw_arc(~[]);
|
let x = arc::RWARC(~[]);
|
||||||
((&x).clone(), x)
|
((&x).clone(), x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~arc::rw_arc(1);
|
let x = ~arc::RWARC(1);
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_cond |_one, cond| {
|
do x.write_cond |_one, cond| {
|
||||||
y = Some(cond);
|
y = Some(cond);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~arc::rw_arc(1);
|
let x = ~arc::RWARC(1);
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
y = Some(x.downgrade(write_mode));
|
y = Some(x.downgrade(write_mode));
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~arc::rw_arc(1);
|
let x = ~arc::RWARC(1);
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write |one| {
|
do x.write |one| {
|
||||||
y = Some(one);
|
y = Some(one);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~arc::rw_arc(1);
|
let x = ~arc::RWARC(1);
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
do (&write_mode).write_cond |_one, cond| {
|
do (&write_mode).write_cond |_one, cond| {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~arc::rw_arc(1);
|
let x = ~arc::RWARC(1);
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
y = Some(write_mode);
|
y = Some(write_mode);
|
||||||
|
|
|
@ -6,7 +6,7 @@ import comm::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = arc::arc(v);
|
let arc_v = arc::ARC(v);
|
||||||
|
|
||||||
do task::spawn() {
|
do task::spawn() {
|
||||||
let v = *arc::get(&arc_v);
|
let v = *arc::get(&arc_v);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import comm::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = arc::arc(v);
|
let arc_v = arc::ARC(v);
|
||||||
|
|
||||||
do task::spawn() |move arc_v| { //~ NOTE move of variable occurred here
|
do task::spawn() |move arc_v| { //~ NOTE move of variable occurred here
|
||||||
let v = *arc::get(&arc_v);
|
let v = *arc::get(&arc_v);
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std;
|
||||||
import std::sync;
|
import std::sync;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let m = ~sync::mutex();
|
let m = ~sync::Mutex();
|
||||||
let mut cond = None;
|
let mut cond = None;
|
||||||
do m.lock_cond |c| {
|
do m.lock_cond |c| {
|
||||||
cond = Some(c);
|
cond = Some(c);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::sync;
|
import std::sync;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~sync::rwlock();
|
let x = ~sync::RWlock();
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_cond |cond| {
|
do x.write_cond |cond| {
|
||||||
y = Some(cond);
|
y = Some(cond);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::sync;
|
import std::sync;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~sync::rwlock();
|
let x = ~sync::RWlock();
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
y = Some(x.downgrade(write_mode));
|
y = Some(x.downgrade(write_mode));
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::sync;
|
import std::sync;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~sync::rwlock();
|
let x = ~sync::RWlock();
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
do (&write_mode).write_cond |cond| {
|
do (&write_mode).write_cond |cond| {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use std;
|
use std;
|
||||||
import std::sync;
|
import std::sync;
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~sync::rwlock();
|
let x = ~sync::RWlock();
|
||||||
let mut y = None;
|
let mut y = None;
|
||||||
do x.write_downgrade |write_mode| {
|
do x.write_downgrade |write_mode| {
|
||||||
y = Some(write_mode);
|
y = Some(write_mode);
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn test_ser_and_deser<A>(a1: A,
|
||||||
let buf = io::mem_buffer();
|
let buf = io::mem_buffer();
|
||||||
let w = ebml::Writer(buf as io::Writer);
|
let w = ebml::Writer(buf as io::Writer);
|
||||||
ebml_ser_fn(w, a1);
|
ebml_ser_fn(w, a1);
|
||||||
let d = ebml::doc(@io::mem_buffer_buf(buf));
|
let d = ebml::Doc(@io::mem_buffer_buf(buf));
|
||||||
let a2 = ebml_deser_fn(ebml::ebml_deserializer(d));
|
let a2 = ebml_deser_fn(ebml::ebml_deserializer(d));
|
||||||
io::print(~"\na1 = ");
|
io::print(~"\na1 = ");
|
||||||
io_ser_fn(io::stdout(), a1);
|
io_ser_fn(io::stdout(), a1);
|
||||||
|
|
Loading…
Reference in a new issue