Skip to content

Commit

Permalink
qualify types for derive Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Indra-db committed Mar 4, 2024
1 parent e042a71 commit d1a7cd2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions flecs_ecs_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn impl_cached_component_data_struct(
try_register_struct_component::<Self>(world);
}

fn register_explicit_named(world: *mut WorldT, name: &CStr)
fn register_explicit_named(world: *mut WorldT, name: &std::ffi::CStr)
{
use std::ffi::CStr;
try_register_struct_component_named::<Self>(world, name);
Expand Down Expand Up @@ -124,15 +124,15 @@ fn impl_cached_component_data_struct(
unsafe { Self::get_allow_tag_unchecked() }
}

fn __get_once_lock_data() -> &'static OnceLock<ComponentData> {
static ONCE_LOCK: OnceLock<ComponentData> = OnceLock::new();
fn __get_once_lock_data() -> &'static std::sync::OnceLock<ComponentData> {
static ONCE_LOCK: std::sync::OnceLock<ComponentData> = std::sync::OnceLock::new();
&ONCE_LOCK
}

// Function for C compatibility, returns null-terminated string.
fn get_symbol_name_c() -> &'static str {
use std::any::type_name;
static SYMBOL_NAME_C: OnceLock<String> = OnceLock::new();
static SYMBOL_NAME_C: std::sync::OnceLock<String> = std::sync::OnceLock::new();
SYMBOL_NAME_C.get_or_init(|| {
let mut name = type_name::<Self>().replace("::", ".");
name.push('\0'); // Add null terminator to make it C compatible.
Expand Down Expand Up @@ -309,7 +309,7 @@ fn impl_cached_component_data_enum(ast: &syn::DeriveInput) -> TokenStream {
try_register_enum_component::<Self>(world);
}

fn register_explicit_named(world: *mut WorldT, name: &CStr)
fn register_explicit_named(world: *mut WorldT, name: &std::ffi::CStr)
{
use std::ffi::CStr;
try_register_enum_component_named::<Self>(world, name);
Expand Down Expand Up @@ -346,15 +346,15 @@ fn impl_cached_component_data_enum(ast: &syn::DeriveInput) -> TokenStream {
unsafe { Self::get_allow_tag_unchecked() }
}

fn __get_once_lock_data() -> &'static OnceLock<ComponentData> {
static ONCE_LOCK: OnceLock<ComponentData> = OnceLock::new();
fn __get_once_lock_data() -> &'static std::sync::OnceLock<ComponentData> {
static ONCE_LOCK: std::sync::OnceLock<ComponentData> = std::sync::OnceLock::new();
&ONCE_LOCK
}

// Function for C compatibility, returns null-terminated string.
fn get_symbol_name_c() -> &'static str {
use std::any::type_name;
static SYMBOL_NAME_C: OnceLock<String> = OnceLock::new();
static SYMBOL_NAME_C: std::sync::OnceLock<String> = std::sync::OnceLock::new();
SYMBOL_NAME_C.get_or_init(|| {
let mut name = type_name::<Self>().replace("::", ".");
name.push('\0'); // Add null terminator to make it C compatible.
Expand Down

0 comments on commit d1a7cd2

Please sign in to comment.