Skip to content

Commit

Permalink
chore!: reduce root exports
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Oct 15, 2023
1 parent f2267c9 commit 1485751
Show file tree
Hide file tree
Showing 67 changed files with 228 additions and 120 deletions.
6 changes: 5 additions & 1 deletion examples/guide/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use flax::{filter::All, *};
use flax::{
components::{child_of, name},
filter::All,
*,
};
use itertools::Itertools;
use rand::{rngs::StdRng, Rng, SeedableRng};
use tracing::info_span;
Expand Down
4 changes: 2 additions & 2 deletions examples/guide/change_detection.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{thread::sleep, time::Duration};

use flax::{
component, entity_ids, name, CommandBuffer, Entity, FetchExt, Query, QueryBorrow, Schedule,
System, World,
component, components::name, entity_ids, CommandBuffer, Entity, FetchExt, Query, QueryBorrow,
Schedule, System, World,
};
use itertools::Itertools;
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
Expand Down
5 changes: 4 additions & 1 deletion examples/guide/commandbuffer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use anyhow::Context;
use flax::*;
use flax::{
components::{child_of, name},
*,
};
use glam::{vec2, Mat4, Vec2};
use rand::{rngs::StdRng, Rng, SeedableRng};
use tracing_subscriber::{prelude::*, registry};
Expand Down
5 changes: 4 additions & 1 deletion examples/guide/relations.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use flax::*;
use flax::{
components::{child_of, name},
*,
};
use itertools::Itertools;
use tracing_subscriber::{prelude::*, registry};
use tracing_tree::HierarchicalLayer;
Expand Down
2 changes: 1 addition & 1 deletion examples/guide/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn main() {}

#[cfg(feature = "serde")]
fn main() -> anyhow::Result<()> {
use flax::*;
use flax::{components::name, *};
use glam::*;
use rand::{distributions::Standard, rngs::StdRng, Rng, SeedableRng};

Expand Down
2 changes: 1 addition & 1 deletion examples/query/basic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::f32::consts::TAU;

use flax::*;
use flax::{components::name, *};
use glam::{vec3, Vec3};
use itertools::Itertools;
use rand::{rngs::StdRng, Rng, SeedableRng};
Expand Down
2 changes: 1 addition & 1 deletion examples/query/graphs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use flax::{child_of, entity_ids, name, Dfs, Entity, Query, Topo, World};
use flax::{components::{name, child_of}, entity_ids, Dfs, Entity, Query, Topo, World};
use tracing_subscriber::{prelude::*, EnvFilter};
use tracing_tree::HierarchicalLayer;

Expand Down
6 changes: 5 additions & 1 deletion examples/query/transform.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use flax::{filter::All, *};
use flax::{
components::{child_of, name},
filter::All,
*,
};
use glam::{vec3, Vec3};
use std::fmt::Write;
use tracing_subscriber::{prelude::*, EnvFilter};
Expand Down
6 changes: 5 additions & 1 deletion src/archetype/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ use core::mem;

use alloc::{collections::BTreeMap, vec::Vec};

use crate::{error::Result, Component, ComponentDesc, ComponentKey, ComponentValue, Entity, Error};
use crate::{
component::{ComponentDesc, ComponentKey, ComponentValue},
error::Result,
Component, Entity, Error,
};

use super::Storage;

Expand Down
2 changes: 1 addition & 1 deletion src/archetype/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::{

use atomic_refcell::{AtomicRef, AtomicRefMut};

use crate::{ComponentValue, Entity};
use crate::{component::ComponentValue, Entity};

use super::{CellData, Changes, Slice, Slot};

Expand Down
3 changes: 2 additions & 1 deletion src/archetype/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, BorrowError, BorrowMutError};
use itertools::Itertools;

use crate::{
component::{ComponentDesc, ComponentKey, ComponentValue},
events::{EventData, EventKind, EventSubscriber},
writer::ComponentUpdater,
Component, ComponentDesc, ComponentKey, ComponentValue, Entity,
Component, Entity,
};

/// Unique archetype id
Expand Down
2 changes: 1 addition & 1 deletion src/archetype/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloc::{
alloc::alloc, alloc::dealloc, alloc::handle_alloc_error, alloc::realloc, alloc::Layout,
};

use crate::{ComponentDesc, ComponentKey, ComponentValue};
use crate::component::{ComponentDesc, ComponentKey, ComponentValue};

use super::Slot;

Expand Down
5 changes: 3 additions & 2 deletions src/archetypes.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use alloc::{sync::Arc, vec::Vec};

use crate::{
archetype::Archetype,
archetype::{Archetype, ArchetypeId},
component::ComponentDesc,
entity::{EntityKind, EntityStore, EntityStoreIter, EntityStoreIterMut},
events::EventSubscriber,
metadata::exclusive,
ArchetypeId, ComponentDesc, Entity,
Entity,
};

pub(crate) struct Archetypes {
Expand Down
3 changes: 2 additions & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use core::ptr::{self, NonNull};
use alloc::alloc::{dealloc, handle_alloc_error, realloc};
use alloc::collections::BTreeMap;

use crate::component::{ComponentDesc, ComponentKey, ComponentValue};
use crate::format::MissingDebug;
use crate::metadata::debuggable;
use crate::{metadata, Component, ComponentDesc, ComponentKey, ComponentValue, Entity};
use crate::{metadata, Component, Entity};

type Offset = usize;

Expand Down
3 changes: 2 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use anyhow::Context;

use crate::{
buffer::MultiComponentBuffer,
component::{ComponentDesc, ComponentValue},
writer::{MissingDyn, SingleComponentWriter, WriteDedupDyn},
BatchSpawn, Component, ComponentDesc, ComponentValue, Entity, EntityBuilder, World,
BatchSpawn, Component, Entity, EntityBuilder, World,
};

type DeferFn = Box<dyn Fn(&mut World) -> anyhow::Result<()> + Send + Sync>;
Expand Down
2 changes: 1 addition & 1 deletion src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloc::string::String;
use crate::component;
use crate::Exclusive;

use crate::ComponentDesc;
use crate::component::ComponentDesc;
use crate::Debuggable;

component! {
Expand Down
8 changes: 5 additions & 3 deletions src/entity/builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::{
buffer::ComponentBuffer, error::Result, CommandBuffer, Component, ComponentDesc,
ComponentValue, Entity, RelationExt, World,
buffer::ComponentBuffer,
component::{ComponentDesc, ComponentValue},
error::Result,
CommandBuffer, Component, Entity, RelationExt, World,
};
use alloc::{boxed::Box, vec::Vec};

Expand Down Expand Up @@ -207,7 +209,7 @@ impl From<&mut EntityBuilder> for EntityBuilder {

#[cfg(test)]
mod test {
use crate::{error::MissingComponent, *};
use crate::{component, components::name, error::MissingComponent, Entity, Error, World};

#[test]
fn builder() {
Expand Down
11 changes: 8 additions & 3 deletions src/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ use once_cell::unsync::OnceCell;

use crate::{
archetype::{Archetype, RefMut},
component::{ComponentKey, ComponentValue},
components::name,
entity::EntityLocation,
entry::{Entry, OccupiedEntry, VacantEntry},
error::MissingComponent,
format::EntityFormatter,
name,
query::QueryOne,
writer::{EntityWriter, FnWriter, Missing, Replace, SingleComponentWriter, WriteDedup},
Component, ComponentKey, ComponentValue, Entity, Fetch, RelationExt, World,
Component, Entity, Fetch, RelationExt, World,
};
use crate::{RelationIter, RelationIterMut};

Expand Down Expand Up @@ -479,7 +480,11 @@ impl Display for EntityRefMut<'_> {
#[cfg(test)]
mod test {

use crate::{component, components::name, is_static, EntityBuilder, FetchExt, Query};
use crate::{
component,
components::{is_static, name},
EntityBuilder, FetchExt, Query,
};

use super::*;

Expand Down
3 changes: 2 additions & 1 deletion src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use core::mem;

use crate::{
archetype::RefMut,
component::ComponentValue,
writer::{Replace, SingleComponentWriter},
Component, ComponentValue, Entity, World,
Component, Entity, World,
};

/// Entry like api for an entity's component
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt::Display;

use crate::{ComponentDesc, Entity};
use crate::{component::ComponentDesc, Entity};

#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
Expand Down
5 changes: 4 additions & 1 deletion src/events.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use alloc::vec::Vec;

use crate::{
archetype::Archetype, filter::StaticFilter, ComponentDesc, ComponentKey, ComponentValue, Entity,
archetype::Archetype,
component::{ComponentDesc, ComponentKey, ComponentValue},
filter::StaticFilter,
Entity,
};

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion src/fetch/component.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use atomic_refcell::AtomicRef;

use crate::{archetype::Slot, system::AccessKind, util::Ptr, Component, ComponentValue};
use crate::{archetype::Slot, component::ComponentValue, system::AccessKind, util::Ptr, Component};

use super::{read_only::RandomFetch, *};

Expand Down
3 changes: 2 additions & 1 deletion src/fetch/component_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ use core::fmt::{self, Formatter};

use crate::{
archetype::{Archetype, CellMutGuard, Slice},
component::ComponentValue,
system::{Access, AccessKind},
util::PtrMut,
Component, ComponentValue, Fetch, FetchItem,
Component, Fetch, FetchItem,
};

use super::{FetchAccessData, FetchPrepareData, PreparedFetch};
Expand Down
7 changes: 5 additions & 2 deletions src/fetch/entity_ref.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use alloc::vec::Vec;

use crate::{
archetype::ArchetypeId,
archetype::{Archetype, Slot},
entity::EntityLocation,
system::{Access, AccessKind},
ArchetypeId, EntityRef, Fetch, FetchItem, World,
EntityRef, Fetch, FetchItem, World,
};

use super::{FetchAccessData, PreparedFetch};
Expand Down Expand Up @@ -104,7 +105,9 @@ impl<'w, 'q> PreparedFetch<'q> for PreparedEntityRef<'w> {
mod test {
use itertools::Itertools;

use crate::{component, name, BatchSpawn, Entity, EntityIds, FetchExt, Query, World};
use crate::{
component, components::name, BatchSpawn, Entity, EntityIds, FetchExt, Query, World,
};

#[test]
fn entity_refs_chunks() {
Expand Down
3 changes: 2 additions & 1 deletion src/fetch/ext.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
component::ComponentValue,
filter::{Cmp, Equal, Greater, GreaterEq, Less, LessEq},
ComponentValue, Fetch, FetchItem, RelationExt,
Fetch, FetchItem, RelationExt,
};

use super::{
Expand Down
3 changes: 2 additions & 1 deletion src/fetch/maybe_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use core::marker::PhantomData;

use crate::{
archetype::{Cell, RefMut, Slot},
component::ComponentValue,
system::{Access, AccessKind},
Component, ComponentValue, Entity, Fetch, FetchItem,
Component, Entity, Fetch, FetchItem,
};

use super::{FetchAccessData, PreparedFetch, RandomFetch};
Expand Down
4 changes: 2 additions & 2 deletions src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ mod source;
mod transform;

use crate::{
archetype::{Archetype, Slice, Slot},
archetype::{Archetype, ArchetypeId, Slice, Slot},
filter::{RefFetch, StaticFilter},
system::Access,
util::Ptr,
ArchetypeId, ArchetypeSearcher, Entity, EntityRef, World,
ArchetypeSearcher, Entity, World,
};
use alloc::vec::Vec;
use core::fmt::Debug;
Expand Down
4 changes: 2 additions & 2 deletions src/fetch/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use smallvec::SmallVec;

use crate::{
archetype::{CellGuard, Slot},
component::dummy,
component::{dummy, ComponentValue},
system::{Access, AccessKind},
Component, ComponentValue, Entity, Fetch, FetchItem, RelationExt,
Component, Entity, Fetch, FetchItem, RelationExt,
};

use super::{FetchAccessData, FetchPrepareData, PreparedFetch};
Expand Down
2 changes: 1 addition & 1 deletion src/fetch/satisfied.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod test {
use itertools::Itertools;
use pretty_assertions::assert_eq;

use crate::{component, name, Entity, FetchExt, Query, World};
use crate::{component, components::name, Entity, FetchExt, Query, World};

component! {
a: i32,
Expand Down
10 changes: 7 additions & 3 deletions src/fetch/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use core::{fmt::Debug, marker::PhantomData};
use alloc::vec::Vec;

use crate::{
archetype::{Archetype, Slice, Slot},
archetype::{Archetype, ArchetypeId, Slice, Slot},
system::Access,
ArchetypeId, Entity, Fetch, FetchItem,
Entity, Fetch, FetchItem,
};

use super::{FetchAccessData, FetchPrepareData, PreparedFetch, RandomFetch};
Expand Down Expand Up @@ -268,7 +268,11 @@ pub struct PreparedSource<'w, Q> {
mod test {
use itertools::Itertools;

use crate::{child_of, component, entity_ids, name, FetchExt, Query, Topo, World};
use crate::{
component,
components::{child_of, name},
entity_ids, FetchExt, Query, Topo, World,
};

use super::*;

Expand Down
3 changes: 2 additions & 1 deletion src/fetch/transform.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
archetype::ChangeKind, filter::ChangeFilter, filter::Union, Component, ComponentValue,
archetype::ChangeKind, component::ComponentValue, filter::ChangeFilter, filter::Union,
Component,
};

/// Allows transforming a fetch into another.
Expand Down
3 changes: 2 additions & 1 deletion src/filter/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use core::fmt::Formatter;
use itertools::Itertools;

use crate::archetype::{CellGuard, Change, Slot};
use crate::component::ComponentValue;
use crate::fetch::{FetchAccessData, FetchPrepareData, PreparedFetch, RandomFetch};
use crate::system::Access;
use crate::util::Ptr;
use crate::{
archetype::{ChangeKind, ChangeList, Slice},
Component, ComponentValue, Fetch, FetchItem,
Component, Fetch, FetchItem,
};

static EMPTY_CHANGELIST: ChangeList = ChangeList::new();
Expand Down
Loading

0 comments on commit 1485751

Please sign in to comment.