Coverage Report

Created: 2026-09-19 07:25

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
11.6M
    pub fn new(value: T, func: F) -> Self {
13
11.6M
        Defer {
14
11.6M
            value: ManuallyDrop::new(value),
15
11.6M
            f: Some(func),
16
11.6M
        }
17
11.6M
    }
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.26k
    pub fn new(value: T, func: F) -> Self {
13
4.26k
        Defer {
14
4.26k
            value: ManuallyDrop::new(value),
15
4.26k
            f: Some(func),
16
4.26k
        }
17
4.26k
    }
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.57k
    pub fn new(value: T, func: F) -> Self {
13
2.57k
        Defer {
14
2.57k
            value: ManuallyDrop::new(value),
15
2.57k
            f: Some(func),
16
2.57k
        }
17
2.57k
    }
<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
76
    pub fn new(value: T, func: F) -> Self {
13
76
        Defer {
14
76
            value: ManuallyDrop::new(value),
15
76
            f: Some(func),
16
76
        }
17
76
    }
<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.59k
    pub fn new(value: T, func: F) -> Self {
13
2.59k
        Defer {
14
2.59k
            value: ManuallyDrop::new(value),
15
2.59k
            f: Some(func),
16
2.59k
        }
17
2.59k
    }
<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
11.1M
    pub fn new(value: T, func: F) -> Self {
13
11.1M
        Defer {
14
11.1M
            value: ManuallyDrop::new(value),
15
11.1M
            f: Some(func),
16
11.1M
        }
17
11.1M
    }
<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
511k
    pub fn new(value: T, func: F) -> Self {
13
511k
        Defer {
14
511k
            value: ManuallyDrop::new(value),
15
511k
            f: Some(func),
16
511k
        }
17
511k
    }
<reblessive::defer::Defer<&reblessive::tree::schedular::Schedular, <reblessive::tree::schedular::Schedular>::poll::{closure#0}>>::new
Line
Count
Source
12
2.60k
    pub fn new(value: T, func: F) -> Self {
13
2.60k
        Defer {
14
2.60k
            value: ManuallyDrop::new(value),
15
2.60k
            f: Some(func),
16
2.60k
        }
17
2.60k
    }
18
19
    #[allow(dead_code)]
20
32
    pub fn take(mut self) -> T {
21
32
        self.f = None;
22
32
        unsafe { ManuallyDrop::take(&mut self.value) }
23
32
    }
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
32
    pub fn take(mut self) -> T {
21
32
        self.f = None;
22
32
        unsafe { ManuallyDrop::take(&mut self.value) }
23
32
    }
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
11.6M
    fn drop(&mut self) {
45
11.6M
        if let Some(x) = self.f.take() {
46
11.6M
            (x)(&mut *self.value);
47
11.6M
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
32
        }
49
11.6M
    }
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.26k
    fn drop(&mut self) {
45
4.26k
        if let Some(x) = self.f.take() {
46
4.26k
            (x)(&mut *self.value);
47
4.26k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
4.26k
    }
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.57k
    fn drop(&mut self) {
45
2.57k
        if let Some(x) = self.f.take() {
46
2.57k
            (x)(&mut *self.value);
47
2.57k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
2.57k
    }
<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
76
    fn drop(&mut self) {
45
76
        if let Some(x) = self.f.take() {
46
76
            (x)(&mut *self.value);
47
76
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
76
    }
<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.59k
    fn drop(&mut self) {
45
2.59k
        if let Some(x) = self.f.take() {
46
2.59k
            (x)(&mut *self.value);
47
2.59k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
2.59k
    }
<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
11.1M
    fn drop(&mut self) {
45
11.1M
        if let Some(x) = self.f.take() {
46
11.1M
            (x)(&mut *self.value);
47
11.1M
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
11.1M
    }
<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
511k
    fn drop(&mut self) {
45
511k
        if let Some(x) = self.f.take() {
46
511k
            (x)(&mut *self.value);
47
511k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
0
        }
49
511k
    }
<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.60k
    fn drop(&mut self) {
45
2.60k
        if let Some(x) = self.f.take() {
46
2.57k
            (x)(&mut *self.value);
47
2.57k
            unsafe { ManuallyDrop::drop(&mut self.value) }
48
32
        }
49
2.60k
    }
50
}