Skip to content

Commit a7386ae

Browse files
committed
adjust lib.rs
1 parent 401cae6 commit a7386ae

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

src/chunk.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
use std::collections::VecDeque;
22

3-
use crate::{span::Span, ChunkIdx, CowStr, TextSize};
3+
use index_vec::IndexVec;
4+
5+
use crate::{span::Span, CowStr, TextSize};
6+
7+
index_vec::define_index_type! {
8+
pub struct ChunkIdx = u32;
9+
}
10+
11+
pub type ChunkVec<'s> = IndexVec<ChunkIdx, Chunk<'s>>;
412

513
#[derive(Debug)]
614
pub struct EditOptions {

src/lib.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
mod chunk;
2+
mod decoded_map;
23
mod joiner;
34
mod locator;
45
mod magic_string;
56
mod mappings;
67
mod source_map;
78
mod span;
8-
mod decoded_map;
9-
10-
use std::borrow::Cow;
119

12-
type CowStr<'s> = Cow<'s, str>;
10+
type CowStr<'text> = std::borrow::Cow<'text, str>;
1311

14-
use chunk::Chunk;
15-
use index_vec::IndexVec;
12+
pub(crate) type TextSize = usize;
1613

1714
pub use crate::{
1815
joiner::{Joiner, JoinerOptions},
1916
magic_string::{
2017
mutation::UpdateOptions, source_map::SourceMapOptions, MagicString, MagicStringOptions,
2118
},
2219
};
23-
24-
index_vec::define_index_type! {
25-
struct ChunkIdx = u32;
26-
}
27-
28-
type ChunkVec<'s> = IndexVec<ChunkIdx, Chunk<'s>>;
29-
30-
index_vec::define_index_type! {
31-
struct SourceIdx = u32;
32-
}
33-
34-
pub(crate) type TextSize = usize;

src/magic_string/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::collections::VecDeque;
66
use rustc_hash::FxHashMap;
77

88
use crate::{
9-
chunk::Chunk, locator::Locator, mappings::Mappings, span::Span, ChunkIdx, ChunkVec, CowStr,
9+
chunk::{Chunk, ChunkVec, ChunkIdx}, locator::Locator, mappings::Mappings, span::Span, CowStr,
1010
TextSize,
1111
};
1212

0 commit comments

Comments
 (0)