Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
75e8b6e
Require first asset in all files to be a top level asset with '0' as …
Imberflur Mar 4, 2026
4fe5697
Update tests
Imberflur Mar 9, 2026
16218c7
more comments in code
Imberflur Mar 4, 2026
e3e91d1
Test that generic types that are referenced are resolved properly (this
Imberflur Mar 6, 2026
9059ef2
Another reference pattern where type resolution doesn't work
Imberflur Mar 6, 2026
4519d34
Fix a couple issues with resolve_path usage and generic types (tests …
Imberflur Mar 9, 2026
bea87f5
Add LocalContext type (not used yet)
Imberflur Mar 9, 2026
de0cbf4
Simplify Symbols usage in convert_values and produce error when a use…
Imberflur Mar 11, 2026
13dbbfa
Clarify note on delaying type resolution for references
Imberflur Mar 11, 2026
bb22e44
More notes on reference type resolution
Imberflur Mar 11, 2026
98c5d97
Fix should_panic test that had the wrong panic and add a new failing …
Imberflur Mar 12, 2026
479e7b3
Fix case where explicit type could be ignored for reference values
Imberflur Mar 12, 2026
1f8d55e
Make Symbols::get_module and Symbols::resolve_item private
Imberflur Mar 13, 2026
8baf6bd
Add new pass when loading files.
Imberflur Mar 25, 2026
8382f9f
Produce an error when the indirect with ident syntax refers to an amb…
Imberflur Mar 26, 2026
b45d078
Report error earlier when we know asset will not exist, make error mo…
Imberflur Mar 31, 2026
c8169c6
Refactor Symbols path resolution to delay uses lookup to prepare for …
Imberflur Apr 6, 2026
0f054bf
Use new ObjectPath enum for fully resolved paths to objects, remove
Imberflur Apr 7, 2026
6cccd0e
Small fix (otherwise, 'static is required for key)
Imberflur Apr 9, 2026
8ee3a0b
More useful ObjectPath methods
Imberflur Apr 23, 2026
71276db
Add dummy top level object to validation file since a top level objec…
Imberflur May 4, 2026
ddd9000
Remove is_subobject, we no longer need this method with the ObjectPat…
Imberflur May 8, 2026
11af202
Add examples of contents of ObjectPath variants
Imberflur May 8, 2026
a61e4a9
Typos and comment cleanup
Imberflur May 8, 2026
a23b1c4
Rename Symbols::add_local_object to more accurate name
Imberflur May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bauble/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
Bauble, BaubleAllocator, ToRustErrorKind, Val, Value,
path::TypePath,
object_path::ObjectPath,
types::{Type, TypeRegistry},
};
use std::{cell::UnsafeCell, fmt::Debug, marker::PhantomData};
Expand All @@ -25,35 +25,35 @@ use std::{cell::UnsafeCell, fmt::Debug, marker::PhantomData};
/// `S` is the inner representation used for `TypePath`.
pub struct Ref<T, S = String> {
/// The path to the referenced asset.
pub path: TypePath<S>,
pub path: ObjectPath<S>,
/// Invariant over `T`.
_mark: PhantomData<UnsafeCell<T>>,
}

impl<T, S> Ref<T, S> {
/// Create a reference from the specified path. The path must not be valid.
pub fn from_path(path: TypePath<S>) -> Self {
pub fn from_path(path: ObjectPath<S>) -> Self {
Self {
path,
_mark: PhantomData,
}
}
}

impl<T, S: PartialEq> PartialEq for Ref<T, S> {
impl<T, S: AsRef<str>> PartialEq for Ref<T, S> {
fn eq(&self, other: &Self) -> bool {
self.path == other.path
}
}
impl<T, S: Eq> Eq for Ref<T, S> {}
impl<T, S: AsRef<str>> Eq for Ref<T, S> {}

impl<T, S: Debug> Debug for Ref<T, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&self.path, f)
}
}

impl<'b, A: BaubleAllocator<'b>, T: Bauble<'b, A>> Bauble<'b, A> for Ref<T, A::TypePathInner> {
impl<'b, A: BaubleAllocator<'b>, T: Bauble<'b, A>> Bauble<'b, A> for Ref<T, A::PathInner> {
fn builtin(registry: &mut TypeRegistry) -> Option<crate::types::TypeId> {
let inner = registry.get_or_register_type::<T, A>();
Some(registry.get_or_register_asset_ref(inner))
Expand All @@ -69,7 +69,7 @@ impl<'b, A: BaubleAllocator<'b>, T: Bauble<'b, A>> Bauble<'b, A> for Ref<T, A::T
) -> Result<<A as BaubleAllocator<'b>>::Out<Self>, crate::ToRustError> {
match val.value.value {
Value::Ref(r) => Ok({
let path = allocator.wrap_type_path(r);
let path = allocator.wrap_object_path(r);
let value = Self {
// SAFETY: path was derived from `allocator`.
path: unsafe { allocator.validate(path)? },
Expand Down
Loading
Loading