Skip to content

Commit b3f6326

Browse files
committed
refactor: rename consume/take
consume and take were overloaded function names. I've changed them to: - into_machine - into_inner (e.g., blockstore -> inner blockstore) - into_store - into_call_manager Otherwise, we have chains like `consume().consume()`.
1 parent 7b826f3 commit b3f6326

File tree

13 files changed

+22
-22
lines changed

13 files changed

+22
-22
lines changed

fvm/src/blockstore/buffered.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
}
3434
}
3535

36-
pub fn consume(self) -> BS {
36+
pub fn into_inner(self) -> BS {
3737
self.base
3838
}
3939
}

fvm/src/call_manager/default.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ where
287287
match kernel.block_create(DAG_CBOR, params) {
288288
Ok(id) => id,
289289
// This could fail if we pass some global memory limit.
290-
Err(err) => return (Err(err), kernel.take()),
290+
Err(err) => return (Err(err), kernel.into_call_manager()),
291291
}
292292
} else {
293293
super::NO_DATA_BLOCK_ID
@@ -303,7 +303,7 @@ where
303303
.or_fatal()
304304
{
305305
Ok(ret) => ret,
306-
Err(err) => return (Err(err), store.into_data().kernel.take()),
306+
Err(err) => return (Err(err), store.into_data().kernel.into_call_manager()),
307307
};
308308

309309
// From this point on, there are no more syscall errors, only aborts.
@@ -335,7 +335,7 @@ where
335335

336336
let invocation_data = store.into_data();
337337
let last_error = invocation_data.last_error;
338-
let mut cm = invocation_data.kernel.take();
338+
let mut cm = invocation_data.kernel.into_call_manager();
339339

340340
// Process the result, updating the backtrace if necessary.
341341
let ret = match result {

fvm/src/executor/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ where
181181

182182
/// Consume consumes the executor and returns the Machine. If the Machine had
183183
/// been poisoned during execution, the Option will be None.
184-
pub fn consume(self) -> Option<<K::CallManager as CallManager>::Machine> {
184+
pub fn into_machine(self) -> Option<<K::CallManager as CallManager>::Machine> {
185185
self.0
186186
}
187187

fvm/src/kernel/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
{
7777
type CallManager = C;
7878

79-
fn take(self) -> Self::CallManager
79+
fn into_call_manager(self) -> Self::CallManager
8080
where
8181
Self: Sized,
8282
{

fvm/src/kernel/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub trait Kernel:
4545
type CallManager: CallManager;
4646

4747
/// Consume the [`Kernel`] and return the underlying [`CallManager`].
48-
fn take(self) -> Self::CallManager
48+
fn into_call_manager(self) -> Self::CallManager
4949
where
5050
Self: Sized;
5151

fvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ mod test {
113113
let mut bs = MemoryBlockstore::default();
114114
let mut st = StateTree::new(bs, StateTreeVersion::V4).unwrap();
115115
let root = st.flush().unwrap();
116-
bs = st.consume();
116+
bs = st.into_store();
117117

118118
// An empty built-in actors manifest.
119119
let manifest_cid = {

fvm/src/machine/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl<M: Machine> Machine for Box<M> {
6464
}
6565

6666
#[inline(always)]
67-
fn consume(self) -> Self::Blockstore {
68-
(*self).consume()
67+
fn into_store(self) -> Self::Blockstore {
68+
(*self).into_store()
6969
}
7070

7171
#[inline(always)]

fvm/src/machine/default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ where
287287
Ok(())
288288
}
289289

290-
fn consume(self) -> Self::Blockstore {
291-
self.state_tree.consume()
290+
fn into_store(self) -> Self::Blockstore {
291+
self.state_tree.into_store()
292292
}
293293
}

fvm/src/machine/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub trait Machine: 'static {
8585
}
8686

8787
/// Consumes the machine and returns the owned blockstore.
88-
fn consume(self) -> Self::Blockstore;
88+
fn into_store(self) -> Self::Blockstore;
8989
}
9090

9191
/// Execution context supplied to the machine.

fvm/src/state_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ where
496496
}
497497

498498
/// Consumes this StateTree and returns the Blockstore it owns via the HAMT.
499-
pub fn consume(self) -> S {
500-
self.hamt.consume()
499+
pub fn into_store(self) -> S {
500+
self.hamt.into_store()
501501
}
502502

503503
pub fn for_each<F>(&self, mut f: F) -> anyhow::Result<()>

0 commit comments

Comments
 (0)