-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baba340
commit 700365d
Showing
9 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ proc-macro = true | |
proc-macro2 = "1.0.86" | ||
quote = "1.0.37" | ||
syn = "2.0.79" | ||
thiserror = "1.0.64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use std::path::Path; | ||
use thiserror::Error; | ||
|
||
/// Contains C++ metadata loaded from a static library. | ||
pub struct Metadata {} | ||
|
||
impl Metadata { | ||
pub fn from_static_lib(path: impl AsRef<Path>) -> Result<Self, MetadataError> { | ||
Ok(Self {}) | ||
} | ||
} | ||
|
||
/// Represents an error when [`Metadata`] fails to load. | ||
#[derive(Debug, Error)] | ||
pub enum MetadataError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
pub use cppbind_macros::*; | ||
|
||
/// RAII struct to free a C++ object on the heap. | ||
pub struct Ptr<T>(*mut T); | ||
/// Memory of a C++ class that live on a heap. | ||
pub struct Heap<T>(*mut T); | ||
|
||
impl<T> Drop for Ptr<T> { | ||
fn drop(&mut self) { | ||
unsafe { std::ptr::drop_in_place(self.0) }; | ||
} | ||
impl<T: Memory> Memory for Heap<T> { | ||
type Class = T::Class; | ||
} | ||
|
||
unsafe impl<T: Send> Send for Heap<T> {} | ||
unsafe impl<T: Sync> Sync for Heap<T> {} | ||
|
||
/// Memory of a C++ class. | ||
pub trait Memory { | ||
type Class; | ||
} |