Skip to content

Commit 0b27e30

Browse files
committed
doc safety
1 parent 8983a5b commit 0b27e30

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

src/edge_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ impl EdgeTable {
197197
Ok(Self { table_ })
198198
}
199199

200+
// # Safety
201+
//
202+
// * this fn must NEVER by part of the public API
203+
// * all returned values must only be visible to the public API
204+
// by REFERENCE (& or &mut)
205+
// * the input ptr must not be NULL
206+
// * the input ptr must point to an initialized table
200207
pub(crate) unsafe fn new_from_table(
201208
edges: *mut ll_bindings::tsk_edge_table_t,
202209
) -> Result<Self, TskitError> {

src/individual_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ impl Iterator for IndividualTableIterator {
183183
}
184184

185185
impl IndividualTable {
186+
// # Safety
187+
//
188+
// * this fn must NEVER by part of the public API
189+
// * all returned values must only be visible to the public API
190+
// by REFERENCE (& or &mut)
191+
// * the input ptr must not be NULL
192+
// * the input ptr must point to an initialized table
186193
pub(crate) unsafe fn new_from_table(
187194
individuals: *mut ll_bindings::tsk_individual_table_t,
188195
) -> Result<Self, TskitError> {

src/migration_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ pub struct MigrationTable {
211211
}
212212

213213
impl MigrationTable {
214+
// # Safety
215+
//
216+
// * this fn must NEVER by part of the public API
217+
// * all returned values must only be visible to the public API
218+
// by REFERENCE (& or &mut)
219+
// * the input ptr must not be NULL
220+
// * the input ptr must point to an initialized table
214221
pub(crate) unsafe fn new_from_table(
215222
migrations: *mut ll_bindings::tsk_migration_table_t,
216223
) -> Result<Self, TskitError> {

src/mutation_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ pub struct MutationTable {
207207
}
208208

209209
impl MutationTable {
210+
// # Safety
211+
//
212+
// * this fn must NEVER by part of the public API
213+
// * all returned values must only be visible to the public API
214+
// by REFERENCE (& or &mut)
215+
// * the input ptr must not be NULL
216+
// * the input ptr must point to an initialized table
210217
pub(crate) unsafe fn new_from_table(
211218
mutations: *mut ll_bindings::tsk_mutation_table_t,
212219
) -> Result<Self, TskitError> {

src/node_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,13 @@ impl NodeTable {
439439
Ok(Self { table_ })
440440
}
441441

442+
// # Safety
443+
//
444+
// * this fn must NEVER by part of the public API
445+
// * all returned values must only be visible to the public API
446+
// by REFERENCE (& or &mut)
447+
// * the input ptr must not be NULL
448+
// * the input ptr must point to an initialized table
442449
pub(crate) unsafe fn new_from_table(
443450
nodes: *mut ll_bindings::tsk_node_table_t,
444451
) -> Result<Self, TskitError> {

src/population_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ pub struct PopulationTable {
157157
}
158158

159159
impl PopulationTable {
160+
// # Safety
161+
//
162+
// * this fn must NEVER by part of the public API
163+
// * all returned values must only be visible to the public API
164+
// by REFERENCE (& or &mut)
165+
// * the input ptr must not be NULL
166+
// * the input ptr must point to an initialized table
160167
pub(crate) unsafe fn new_from_table(
161168
populations: *mut ll_bindings::tsk_population_table_t,
162169
) -> Result<Self, TskitError> {

src/provenance.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ pub struct ProvenanceTable {
154154
}
155155

156156
impl ProvenanceTable {
157+
// # Safety
158+
//
159+
// * this fn must NEVER by part of the public API
160+
// * all returned values must only be visible to the public API
161+
// by REFERENCE (& or &mut)
162+
// * the input ptr must not be NULL
163+
// * the input ptr must point to an initialized table
157164
pub(crate) unsafe fn new_from_table(
158165
provenances: *mut ll_bindings::tsk_provenance_table_t,
159166
) -> Result<Self, crate::TskitError> {

src/site_table.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ pub struct SiteTable {
176176
}
177177

178178
impl SiteTable {
179+
// # Safety
180+
//
181+
// * this fn must NEVER by part of the public API
182+
// * all returned values must only be visible to the public API
183+
// by REFERENCE (& or &mut)
184+
// * the input ptr must not be NULL
185+
// * the input ptr must point to an initialized table
179186
pub(crate) unsafe fn new_from_table(
180187
sites: *mut ll_bindings::tsk_site_table_t,
181188
) -> Result<Self, TskitError> {

0 commit comments

Comments
 (0)