Coverage Report

Created: 2026-11-03 08:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/reblessive-0.4.3/src/defer.rs
Line
Count
Source
1
use std::{
2
    mem::ManuallyDrop,
3
    ops::{Deref, DerefMut},
4
};
5
6
pub struct Defer<T, F: FnOnce(&mut T)> {
7
    value: ManuallyDrop<T>,
8
    f: Option<F>,
9
}
10
11
impl<T, F: FnOnce(&mut T)> Defer<T, F> {
12
13.7M
    pub fn new(value: T, func: F) -> Self {
13
13.7M
        Defer {
14
13.7M
            value: ManuallyDrop::new(value),
15
13.7M
            f: Some(func),
16
13.7M
        }
17
13.7M
    }
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_types::value::Value, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_types::value::record_id::RecordId, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::gql::ast::GqlQuery, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::expression::Expr, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::ast::TopLevelExpr, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::ast::Ast, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::kind::Kind, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::block::Block, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::idiom::Idiom, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::function::Function, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::val::table::TableName, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::expr::match_plan::MatchPlan, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}>>::new
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<surrealdb_core::val::Value, anyhow::Error>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<surrealdb_core::val::Value, anyhow::Error>>>::{closure#1}>>::new
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<surrealdb_core::val::Value, surrealdb_core::expr::ControlFlow>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<surrealdb_core::val::Value, surrealdb_core::expr::ControlFlow>>>::{closure#1}>>::new
Line
Count
Source
12
4.96k
    pub fn new(value: T, func: F) -> Self {
13
4.96k
        Defer {
14
4.96k
            value: ManuallyDrop::new(value),
15
4.96k
            f: Some(func),
16
4.96k
        }
17
4.96k
    }
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<(), anyhow::Error>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<(), anyhow::Error>>>::{closure#1}>>::new
<reblessive::defer::Defer<reblessive::ptr::Owned<reblessive::tree::schedular::Task<u8>>, <reblessive::tree::schedular::CancelToken as core::ops::drop::Drop>::drop::{closure#0}>>::new
Line
Count
Source
12
2.85k
    pub fn new(value: T, func: F) -> Self {
13
2.85k
        Defer {
14
2.85k
            value: ManuallyDrop::new(value),
15
2.85k
            f: Some(func),
16
2.85k
        }
17
2.85k
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<()>::{closure#0}, ()>::{closure#1}>>::new
Line
Count
Source
12
82
    pub fn new(value: T, func: F) -> Self {
13
82
        Defer {
14
82
            value: ManuallyDrop::new(value),
15
82
            f: Some(func),
16
82
        }
17
82
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::TreeStack>::drive_top_task::{closure#0}::{closure#0}, bool>::{closure#1}>>::new
Line
Count
Source
12
2.88k
    pub fn new(value: T, func: F) -> Self {
13
2.88k
        Defer {
14
2.88k
            value: ManuallyDrop::new(value),
15
2.88k
            f: Some(func),
16
2.88k
        }
17
2.88k
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::drive_top_task::{closure#0}, core::task::poll::Poll<bool>>::{closure#1}>>::new
Line
Count
Source
12
13.0M
    pub fn new(value: T, func: F) -> Self {
13
13.0M
        Defer {
14
13.0M
            value: ManuallyDrop::new(value),
15
13.0M
            f: Some(func),
16
13.0M
        }
17
13.0M
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::tree::schedular::Schedular>>, <reblessive::tree::TreeStack>::enter_context<<reblessive::tree::TreeStack>::drive_top_task::{closure#0}, core::task::poll::Poll<bool>>::{closure#0}>>::new
Line
Count
Source
12
709k
    pub fn new(value: T, func: F) -> Self {
13
709k
        Defer {
14
709k
            value: ManuallyDrop::new(value),
15
709k
            f: Some(func),
16
709k
        }
17
709k
    }
<reblessive::defer::Defer<&reblessive::tree::schedular::Schedular, <reblessive::tree::schedular::Schedular>::poll::{closure#0}>>::new
Line
Count
Source
12
2.92k
    pub fn new(value: T, func: F) -> Self {
13
2.92k
        Defer {
14
2.92k
            value: ManuallyDrop::new(value),
15
2.92k
            f: Some(func),
16
2.92k
        }
17
2.92k
    }
18
19
    #[allow(dead_code)]
20
68
    pub fn take(mut self) -> T {
21
68
        self.f = None;
22
68
        unsafe { ManuallyDrop::take(&mut self.value) }
23
68
    }
Unexecuted instantiation: <reblessive::defer::Defer<reblessive::ptr::Owned<reblessive::tree::schedular::Task<u8>>, <reblessive::tree::schedular::CancelToken as core::ops::drop::Drop>::drop::{closure#0}>>::take
<reblessive::defer::Defer<&reblessive::tree::schedular::Schedular, <reblessive::tree::schedular::Schedular>::poll::{closure#0}>>::take
Line
Count
Source
20
68
    pub fn take(mut self) -> T {
21
68
        self.f = None;
22
68
        unsafe { ManuallyDrop::take(&mut self.value) }
23
68
    }
24
}
25
26
impl<T, F: FnOnce(&mut T)> Deref for Defer<T, F> {
27
    type Target = T;
28
29
0
    fn deref(&self) -> &Self::Target {
30
0
        &self.value
31
0
    }
32
}
33
34
impl<T, F: FnOnce(&mut T)> DerefMut for Defer<T, F> {
35
0
    fn deref_mut(&mut self) -> &mut Self::Target {
36
0
        &mut self.value
37
0
    }
38
}
39
40
impl<T, F> Drop for Defer<T, F>
41
where
42
    F: FnOnce(&mut T),
43
{
44
13.7M
    fn drop(&mut self) {
45
13.7M
        if let Some(x) = self.f.take() {
46
13.7M
            (x)(&mut *self.value);
47
13.7M
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
68
        }
49
13.7M
    }
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_types::value::Value, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_types::value::record_id::RecordId, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::gql::ast::GqlQuery, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::expression::Expr, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::ast::TopLevelExpr, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::ast::Ast, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::kind::Kind, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::block::Block, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::idiom::Idiom, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::sql::function::Function, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::val::table::TableName, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<core::result::Result<surrealdb_core::expr::match_plan::MatchPlan, surrealdb_core::syn::error::SyntaxError>>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<surrealdb_core::val::Value, anyhow::Error>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<surrealdb_core::val::Value, anyhow::Error>>>::{closure#1}> as core::ops::drop::Drop>::drop
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<surrealdb_core::val::Value, surrealdb_core::expr::ControlFlow>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<surrealdb_core::val::Value, surrealdb_core::expr::ControlFlow>>>::{closure#1}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
4.96k
    fn drop(&mut self) {
45
4.96k
        if let Some(x) = self.f.take() {
46
4.96k
            (x)(&mut *self.value);
47
4.96k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
4.96k
    }
Unexecuted instantiation: <reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::future::ScopeStkFuture<core::result::Result<(), anyhow::Error>> as core::future::future::Future>::poll::{closure#0}::{closure#0}, core::task::poll::Poll<core::result::Result<(), anyhow::Error>>>::{closure#1}> as core::ops::drop::Drop>::drop
<reblessive::defer::Defer<reblessive::ptr::Owned<reblessive::tree::schedular::Task<u8>>, <reblessive::tree::schedular::CancelToken as core::ops::drop::Drop>::drop::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
2.85k
    fn drop(&mut self) {
45
2.85k
        if let Some(x) = self.f.take() {
46
2.85k
            (x)(&mut *self.value);
47
2.85k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
2.85k
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::clear<()>::{closure#0}, ()>::{closure#1}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
82
    fn drop(&mut self) {
45
82
        if let Some(x) = self.f.take() {
46
82
            (x)(&mut *self.value);
47
82
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
82
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::tree::TreeStack>::drive_top_task::{closure#0}::{closure#0}, bool>::{closure#1}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
2.88k
    fn drop(&mut self) {
45
2.88k
        if let Some(x) = self.f.take() {
46
2.88k
            (x)(&mut *self.value);
47
2.88k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
2.88k
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::stack::Stack>>, <reblessive::stack::Stack>::enter_context<<reblessive::stack::Stack>::drive_top_task::{closure#0}, core::task::poll::Poll<bool>>::{closure#1}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
13.0M
    fn drop(&mut self) {
45
13.0M
        if let Some(x) = self.f.take() {
46
13.0M
            (x)(&mut *self.value);
47
13.0M
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
13.0M
    }
<reblessive::defer::Defer<core::option::Option<reblessive::ptr::Owned<reblessive::tree::schedular::Schedular>>, <reblessive::tree::TreeStack>::enter_context<<reblessive::tree::TreeStack>::drive_top_task::{closure#0}, core::task::poll::Poll<bool>>::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
709k
    fn drop(&mut self) {
45
709k
        if let Some(x) = self.f.take() {
46
709k
            (x)(&mut *self.value);
47
709k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
709k
    }
<reblessive::defer::Defer<&reblessive::tree::schedular::Schedular, <reblessive::tree::schedular::Schedular>::poll::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
44
2.92k
    fn drop(&mut self) {
45
2.92k
        if let Some(x) = self.f.take() {
46
2.85k
            (x)(&mut *self.value);
47
2.85k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
68
        }
49
2.92k
    }
50
}