diff --git a/Cargo.toml b/Cargo.toml index 6f919bd..f1b62c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "janus-plugin" version = "0.11.1" +edition = "2018" authors = ["Marshall Quander "] description = "Library for creating plugins for Janus, the WebRTC gateway." repository = "https://github.com/mozilla/janus-plugin-rs" diff --git a/jansson-sys/Cargo.toml b/jansson-sys/Cargo.toml index ca56ee1..b5d348d 100644 --- a/jansson-sys/Cargo.toml +++ b/jansson-sys/Cargo.toml @@ -1,10 +1,11 @@ [package] name = "jansson-sys" version = "0.1.0" +edition = "2018" authors = ["Marshall Quander "] description = "Native bindings for Jansson, the C JSON library." repository = "https://github.com/mozilla/janus-plugin-rs" license = "MPL-2.0" [dev-dependencies] -cstr-macro = "0.1.0" \ No newline at end of file +cstr-macro = "0.1.0" diff --git a/jansson-sys/src/lib.rs b/jansson-sys/src/lib.rs index 5dc4dd4..cebd86e 100644 --- a/jansson-sys/src/lib.rs +++ b/jansson-sys/src/lib.rs @@ -131,8 +131,7 @@ pub unsafe fn json_decref(json: *mut json_t) { } #[cfg(test)] -#[macro_use] -extern crate cstr_macro; +use cstr_macro::cstr; #[cfg(test)] mod tests { diff --git a/janus-plugin-sys/Cargo.toml b/janus-plugin-sys/Cargo.toml index d4f7f8e..db6417c 100644 --- a/janus-plugin-sys/Cargo.toml +++ b/janus-plugin-sys/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "janus-plugin-sys" version = "0.6.0" +edition = "2018" authors = ["Marshall Quander "] description = "Native bindings to the Janus plugin API." repository = "https://github.com/mozilla/janus-plugin-rs" diff --git a/janus-plugin-sys/src/lib.rs b/janus-plugin-sys/src/lib.rs index f105aa4..e6c4fb1 100644 --- a/janus-plugin-sys/src/lib.rs +++ b/janus-plugin-sys/src/lib.rs @@ -1,8 +1,6 @@ #![allow(non_camel_case_types)] #![deny(missing_debug_implementations)] -extern crate glib_sys; -extern crate jansson_sys; use std::os::raw::{c_char, c_int}; pub mod plugin; diff --git a/janus-plugin-sys/src/plugin.rs b/janus-plugin-sys/src/plugin.rs index 55f3ba4..e654f38 100644 --- a/janus-plugin-sys/src/plugin.rs +++ b/janus-plugin-sys/src/plugin.rs @@ -34,7 +34,7 @@ pub struct janus_plugin_session { pub gateway_handle: *mut c_void, pub plugin_handle: *mut c_void, pub stopped: c_int, - pub ref_: ::janus_refcount, + pub ref_: crate::janus_refcount, } #[repr(C)] diff --git a/janus-plugin-sys/src/rtcp.rs b/janus-plugin-sys/src/rtcp.rs index a58a093..d54560e 100644 --- a/janus-plugin-sys/src/rtcp.rs +++ b/janus-plugin-sys/src/rtcp.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] -use super::glib_sys::{gboolean, GSList}; +use glib_sys::{gboolean, GSList}; use std::os::raw::{c_char, c_int, c_uint}; extern "C" { diff --git a/janus-plugin-sys/src/sdp.rs b/janus-plugin-sys/src/sdp.rs index dda276d..3ebafa6 100644 --- a/janus-plugin-sys/src/sdp.rs +++ b/janus-plugin-sys/src/sdp.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] -use super::glib_sys::{gboolean, GList}; +use glib_sys::{gboolean, GList}; use std::os::raw::{c_char, c_int, c_long, c_short, c_ulong}; pub type guint16 = c_short; diff --git a/src/debug.rs b/src/debug.rs index 560bbc7..6305415 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,11 +1,8 @@ /// Utilities for writing messages to the Janus log. -extern crate chrono; -extern crate colored; - pub use super::ffi::janus_log_level as JANUS_LOG_LEVEL; -use self::chrono::{DateTime, Local}; -use self::colored::{Color, Colorize}; -use super::ffi; +use chrono::{DateTime, Local}; +use colored::{Color, Colorize}; +use janus_plugin_sys as ffi; use std::ffi::CString; use std::fmt::Write; use std::fmt; @@ -136,7 +133,7 @@ macro_rules! janus_dbg { mod tests { use super::*; - use super::chrono::TimeZone; + use chrono::TimeZone; fn fixed_clock(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -> DateTime { Local.ymd(year, month, day).and_hms(hour, min, sec) diff --git a/src/jansson.rs b/src/jansson.rs index c6b349c..9f2f0d5 100644 --- a/src/jansson.rs +++ b/src/jansson.rs @@ -1,5 +1,4 @@ /// Utilities to work with Jansson JSON values, which are exposed in the Janus plugin API. -extern crate libc; use jansson_sys; use std::error::Error; @@ -9,7 +8,8 @@ use std::mem::MaybeUninit; use std::ops::Deref; use std::slice; use std::str; -use utils::LibcString; +use crate::utils::LibcString; +use bitflags::bitflags; /// A pointer to a raw Jansson value struct. pub type RawJanssonValue = jansson_sys::json_t; diff --git a/src/lib.rs b/src/lib.rs index ca872da..b2eb188 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,16 +1,11 @@ #![deny(missing_debug_implementations)] -#[macro_use] -extern crate bitflags; -extern crate jansson_sys; -extern crate janus_plugin_sys as ffi; -extern crate glib_sys as glib; -extern crate libc; -extern crate serde; - +use janus_plugin_sys as ffi; +use glib_sys as glib; +use bitflags::bitflags; pub use debug::LogLevel; pub use debug::log; -pub use jansson::{JanssonDecodingFlags, JanssonEncodingFlags, JanssonValue, RawJanssonValue}; +pub use crate::jansson::{JanssonDecodingFlags, JanssonEncodingFlags, JanssonValue, RawJanssonValue}; pub use session::SessionWrapper; pub use ffi::events::janus_eventhandler as EventHandler; pub use ffi::plugin::janus_callbacks as PluginCallbacks; diff --git a/src/sdp.rs b/src/sdp.rs index 8547172..b3a434d 100644 --- a/src/sdp.rs +++ b/src/sdp.rs @@ -1,10 +1,10 @@ /// Utilities to write SDP offers and answers using Janus's SDP parsing machinery. -use super::ffi; -use super::glib; -use super::libc; -use super::serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor}; -use super::serde::ser::{Serialize, Serializer}; +use janus_plugin_sys as ffi; +use glib_sys as glib; +use libc; +use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor}; +use serde::ser::{Serialize, Serializer}; pub use ffi::sdp::janus_sdp_generate_answer as generate_answer; pub use ffi::sdp::janus_sdp_generate_offer as generate_offer; use std::collections::HashMap; @@ -13,7 +13,7 @@ use std::fmt; use std::ffi::{CStr, CString}; use std::ops::Deref; use std::str; -use utils::GLibString; +use crate::utils::GLibString; pub type RawSdp = ffi::sdp::janus_sdp; pub type RawMLine = ffi::sdp::janus_sdp_mline; diff --git a/src/utils.rs b/src/utils.rs index 82746cd..7a09c00 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,8 +1,8 @@ /// Wrapper types and helpers for working with the Janus FFI layer. -use super::glib; -use super::libc; -use super::serde::ser::{self, Serialize, Serializer}; +use glib_sys as glib; +use libc; +use serde::ser::{self, Serialize, Serializer}; use std::error::Error; use std::ffi::CStr; use std::ops::Deref;