Skip to main content

pop_context

Function pop_context 

Source
pub fn pop_context() -> Option<Arc<Context>>
Expand description

Pop and return the top context from the thread-local context stack.

Returns None if the stack is empty.

ยงExample

use click::context::{Context, ContextBuilder, push_context, pop_context};
use std::sync::Arc;

let ctx = Arc::new(ContextBuilder::new().build());
push_context(ctx);

let popped = pop_context();
assert!(popped.is_some());
assert!(pop_context().is_none());