Skip to content

Commit 2c0960b

Browse files
committed
refactor: move collection types to crate::collections
1 parent 6e156b7 commit 2c0960b

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

examples/shared_dict.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ use nginx_sys::{
1010
NGX_HTTP_MAIN_CONF, NGX_HTTP_MAIN_CONF_OFFSET, NGX_HTTP_MODULE, NGX_HTTP_VAR_CHANGEABLE,
1111
NGX_HTTP_VAR_NOCACHEABLE, NGX_LOG_EMERG,
1212
};
13-
use ngx::core::{
14-
NgxStr, NgxString, Pool, RbTreeMap, SlabPool, Status, NGX_CONF_ERROR, NGX_CONF_OK,
15-
};
13+
use ngx::collections::RbTreeMap;
14+
use ngx::core::{NgxStr, NgxString, Pool, SlabPool, Status, NGX_CONF_ERROR, NGX_CONF_OK};
1615
use ngx::http::{HttpModule, HttpModuleMainConf};
1716
use ngx::{ngx_conf_log_error, ngx_log_debug, ngx_string};
1817

src/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ::core::ptr::{self, NonNull};
1414
pub use allocator_api2::alloc::{AllocError, Allocator, Global};
1515

1616
#[cfg(feature = "alloc")]
17-
pub use allocator_api2::{boxed, collections, vec};
17+
pub use allocator_api2::boxed;
1818

1919
/// Explicitly duplicate an object using the specified Allocator.
2020
pub trait TryCloneIn: Sized {

src/collections/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Collection types.
2+
//!
3+
//! This module provides common collection types, mostly implemented as wrappers over the
4+
//! corresponding NGINX types.
5+
6+
#[cfg(feature = "alloc")]
7+
pub use allocator_api2::{
8+
collections::{TryReserveError, TryReserveErrorKind},
9+
vec, // reexport both the module and the macro
10+
vec::Vec,
11+
};
12+
13+
pub use rbtree::RbTreeMap;
14+
15+
pub mod rbtree;
File renamed without changes.

src/core/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
mod buffer;
22
mod pool;
3-
pub mod rbtree;
43
pub mod slab;
54
mod status;
65
mod string;
76

87
pub use buffer::*;
98
pub use pool::*;
10-
pub use rbtree::RbTreeMap;
119
pub use slab::SlabPool;
1210
pub use status::*;
1311
pub use string::*;

src/core/string.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,8 @@ mod _alloc {
207207

208208
use super::*;
209209

210-
use crate::allocator::collections::TryReserveError;
211-
use crate::allocator::vec::Vec;
212210
use crate::allocator::{self, Allocator};
211+
use crate::collections::{TryReserveError, Vec};
213212

214213
/// Owned byte string type with Allocator support.
215214
///

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern crate std;
4343
pub mod allocator;
4444
#[cfg(feature = "async")]
4545
pub mod async_;
46+
pub mod collections;
4647

4748
/// The core module.
4849
///

0 commit comments

Comments
 (0)