pub struct Admin(/* private fields */);Implementations§
Source§impl Admin
impl Admin
pub const fn new(namespace: &'static str) -> Self
pub fn new_dyn(storage_key: impl Into<Namespace>) -> Self
pub fn set<Q: CustomQuery>( &self, deps: DepsMut<'_, Q>, admin: Option<Addr>, ) -> StdResult<()>
pub fn get<Q: CustomQuery>(&self, deps: Deps<'_, Q>) -> StdResult<Option<Addr>>
Sourcepub fn is_admin<Q: CustomQuery>(
&self,
deps: Deps<'_, Q>,
caller: &Addr,
) -> StdResult<bool>
pub fn is_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q>, caller: &Addr, ) -> StdResult<bool>
Returns Ok(true) if this is an admin, Ok(false) if not and an Error if we hit an error with Api or Storage usage
Sourcepub fn assert_admin<Q: CustomQuery>(
&self,
deps: Deps<'_, Q>,
caller: &Addr,
) -> Result<(), AdminError>
pub fn assert_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q>, caller: &Addr, ) -> Result<(), AdminError>
Like is_admin but returns AdminError::NotAdmin if not admin. Helper for a nice one-line auth check.
pub fn execute_update_admin<C, Q: CustomQuery>( &self, deps: DepsMut<'_, Q>, info: MessageInfo, new_admin: Option<Addr>, ) -> Result<Response<C>, AdminError>
pub fn query_admin<Q: CustomQuery>( &self, deps: Deps<'_, Q>, ) -> StdResult<AdminResponse>
Auto Trait Implementations§
impl Freeze for Admin
impl RefUnwindSafe for Admin
impl Send for Admin
impl Sync for Admin
impl Unpin for Admin
impl UnsafeUnpin for Admin
impl UnwindSafe for Admin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more