Skip to content

Commit

Permalink
Use 2018 edition
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Mar 1, 2019
1 parent 2f793a4 commit a44e041
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 34 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[package]
name = "ocaml"
version = "0.5.1"
version = "0.6.0"
authors = ["Zach Shipko <[email protected]>"]
readme = "README.md"
keywords = ["ocaml", "rust", "ffi"]
repository = "https://github.com/zshipko/ocaml-rs"
license = "ISC"
description = "OCaml bindings for Rust"
documentation = "https://docs.rs/ocaml"
edition = "2018"

[dependencies]
4 changes: 2 additions & 2 deletions src/conv.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use types::{Array, Str};
use value::{FromValue, ToValue, Value};
use crate::types::{Array, Str};
use crate::value::{FromValue, ToValue, Value};

macro_rules! value_i {
($t:ty) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/alloc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! External definitions for allocating values in the OCaml runtime
use core::mlvalues::{Size, Tag, Value};
use crate::core::mlvalues::{Size, Tag, Value};

extern "C" {
pub fn caml_alloc(size: Size, tag: Tag) -> Value;
Expand Down
2 changes: 1 addition & 1 deletion src/core/bigarray.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Bigarray bindings
use core::mlvalues::{Intnat, Uintnat, Value};
use crate::core::mlvalues::{Intnat, Uintnat, Value};
use std::os::raw::c_void;

pub type Data = *mut c_void;
Expand Down
2 changes: 1 addition & 1 deletion src/core/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! This is also where you initialize the OCaml runtime system via `caml_startup` or `caml_main`
//!
use core::mlvalues::Value;
use crate::core::mlvalues::Value;

extern "C" {
pub fn caml_callback(closure: Value, arg: Value) -> Value;
Expand Down
2 changes: 1 addition & 1 deletion src/core/fail.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::mlvalues::Value;
use crate::core::mlvalues::Value;

extern "C" {
pub fn caml_raise(bucket: Value);
Expand Down
2 changes: 1 addition & 1 deletion src/core/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
use std::default::Default;
use std::ptr;

use core::mlvalues::{Size, Value};
use crate::core::mlvalues::{Size, Value};

#[repr(C)]
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use value::Value;
use crate::value::Value;

/// Error returned by `ocaml-rs` functions
#[derive(Debug)]
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
//! value ml_add_10(value arg) {
//! CAMLparam1(arg);
//! CAMLlocal(result);
//! int n = int_val(arg);
//! result = val_int(arg + 10)
//! int n = Int_val(arg);
//! result = Val_int(arg + 10)
//! CAMLreturn(result);
//! }
//! ```
Expand All @@ -44,9 +44,9 @@ mod tag;
mod types;
pub mod value;

pub use error::Error;
pub use named::named_value;
pub use runtime::*;
pub use tag::Tag;
pub use types::{Array, Array1, List, Str, Tuple};
pub use value::{FromValue, ToValue, Value};
pub use crate::error::Error;
pub use crate::named::named_value;
pub use crate::runtime::*;
pub use crate::tag::Tag;
pub use crate::types::{Array, Array1, List, Str, Tuple};
pub use crate::value::{FromValue, ToValue, Value};
4 changes: 2 additions & 2 deletions src/named.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core;
use value::Value;
use crate::core;
use crate::value::Value;

/// Returns a named value registered by OCaml
pub fn named_value<S: AsRef<str>>(name: S) -> Option<Value> {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core;
use value::Value;
use crate::core;
use crate::value::Value;

use std::ffi::CString;

Expand Down
16 changes: 8 additions & 8 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use core::alloc;
use core::bigarray;
use core::memory;
use core::mlvalues;
use core::mlvalues::empty_list;
use error::Error;
use tag::Tag;
use crate::core::alloc;
use crate::core::bigarray;
use crate::core::memory;
use crate::core::mlvalues;
use crate::core::mlvalues::empty_list;
use crate::error::Error;
use crate::tag::Tag;

use std::marker::PhantomData;
use std::mem;
use std::ptr;
use std::slice;

use value::{Size, Value};
use crate::value::{Size, Value};

/// OCaml Tuple type
pub struct Tuple(Value, Size);
Expand Down
12 changes: 7 additions & 5 deletions src/value.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use core;
use error::Error;
use runtime::hash_variant;
use tag::{self, Tag};
use crate::core;
use crate::error::Error;
use crate::runtime::hash_variant;
use crate::tag;
use crate::Tag;

use std::{mem, ptr};

Expand Down Expand Up @@ -483,7 +484,8 @@ impl Value {
} else {
Value(*v).deep_clone_to_rust().0
}
}).collect();
})
.collect();
let ptr1 = vec1.as_ptr();
mem::forget(vec1);
return Value::ptr(ptr1.offset(1));
Expand Down

0 comments on commit a44e041

Please sign in to comment.