pub struct MonsterStore { /* private fields */ }Expand description
Monsters, spells and conditions, shared and each campaign’s own, in Postgres.
Implementations§
Source§impl MonsterStore
impl MonsterStore
Sourcepub async fn export_campaign(
&self,
campaign: Uuid,
) -> Result<MonstersExport, ApiError>
pub async fn export_campaign( &self, campaign: Uuid, ) -> Result<MonstersExport, ApiError>
The campaign’s own, as they are.
Sourcepub async fn import_campaign(
&self,
campaign: Uuid,
export: &MonstersExport,
) -> Result<u64, ApiError>
pub async fn import_campaign( &self, campaign: Uuid, export: &MonstersExport, ) -> Result<u64, ApiError>
Takes in a campaign’s own exported elsewhere, as they were: ids, versions and dates. All or nothing, and only while it has none here; returns how many came.
Source§impl MonsterStore
impl MonsterStore
Sourcepub async fn list(&self, scope: Scope) -> Result<Vec<Monster>, ApiError>
pub async fn list(&self, scope: Scope) -> Result<Vec<Monster>, ApiError>
The shared monsters suiting the campaign’s edition and the campaign’s own, by name (the campaign’s first, where both have one).
Sourcepub async fn get(&self, scope: Scope, id: Uuid) -> Result<Monster, ApiError>
pub async fn get(&self, scope: Scope, id: Uuid) -> Result<Monster, ApiError>
A shared monster (of any edition) or one of the campaign’s own.
Sourcepub async fn count_own(&self, campaign: Uuid) -> Result<i64, ApiError>
pub async fn count_own(&self, campaign: Uuid) -> Result<i64, ApiError>
How many monsters of its own campaign keeps.
Sourcepub async fn create(
&self,
scope: Scope,
sheet: MonsterSheet,
) -> Result<Monster, ApiError>
pub async fn create( &self, scope: Scope, sheet: MonsterSheet, ) -> Result<Monster, ApiError>
Adds a monster to the campaign’s own.
Sourcepub async fn replace(
&self,
scope: Scope,
id: Uuid,
sheet: MonsterSheet,
) -> Result<Monster, ApiError>
pub async fn replace( &self, scope: Scope, id: Uuid, sheet: MonsterSheet, ) -> Result<Monster, ApiError>
Replaces one of the campaign’s own monsters.
Sourcepub async fn delete(&self, scope: Scope, id: Uuid) -> Result<(), ApiError>
pub async fn delete(&self, scope: Scope, id: Uuid) -> Result<(), ApiError>
Deletes one of the campaign’s own monsters.
Sourcepub async fn import(
&self,
campaign: Option<Uuid>,
sheets: &[MonsterSheet],
) -> Result<Imported, ApiError>
pub async fn import( &self, campaign: Option<Uuid>, sheets: &[MonsterSheet], ) -> Result<Imported, ApiError>
Adds stat blocks to the shared library (campaign None) or a
campaign. One with the same name, source and edition as an existing
one there replaces it, so importing the same file again updates it.
All or nothing: every stat block is checked first.
Sourcepub async fn export_own(&self, campaign: Uuid) -> Result<Vec<Monster>, ApiError>
pub async fn export_own(&self, campaign: Uuid) -> Result<Vec<Monster>, ApiError>
Deletes a campaign’s own monsters, spells and conditions; returns how many monsters there were. The campaign’s own monsters, as they are.
pub async fn delete_campaign(&self, campaign: Uuid) -> Result<u64, ApiError>
Source§impl MonsterStore
impl MonsterStore
Sourcepub async fn texts<T: RulesText>(
&self,
scope: Scope,
) -> Result<Vec<Entry<T>>, ApiError>
pub async fn texts<T: RulesText>( &self, scope: Scope, ) -> Result<Vec<Entry<T>>, ApiError>
The shared ones suiting the campaign’s edition and the campaign’s own, by name.
Sourcepub async fn text<T: RulesText>(
&self,
scope: Scope,
id: Uuid,
) -> Result<Entry<T>, ApiError>
pub async fn text<T: RulesText>( &self, scope: Scope, id: Uuid, ) -> Result<Entry<T>, ApiError>
A shared one (of any edition) or one of the campaign’s own.
Sourcepub async fn count_own_texts<T: RulesText>(
&self,
campaign: Uuid,
) -> Result<i64, ApiError>
pub async fn count_own_texts<T: RulesText>( &self, campaign: Uuid, ) -> Result<i64, ApiError>
How many texts of this kind of its own campaign keeps.
Sourcepub async fn create_text<T: RulesText>(
&self,
scope: Scope,
text: T,
) -> Result<Entry<T>, ApiError>
pub async fn create_text<T: RulesText>( &self, scope: Scope, text: T, ) -> Result<Entry<T>, ApiError>
Adds one to the campaign’s own.
Sourcepub async fn replace_text<T: RulesText>(
&self,
scope: Scope,
id: Uuid,
text: T,
) -> Result<Entry<T>, ApiError>
pub async fn replace_text<T: RulesText>( &self, scope: Scope, id: Uuid, text: T, ) -> Result<Entry<T>, ApiError>
Replaces one of the campaign’s own.
Sourcepub async fn delete_text<T: RulesText>(
&self,
scope: Scope,
id: Uuid,
) -> Result<(), ApiError>
pub async fn delete_text<T: RulesText>( &self, scope: Scope, id: Uuid, ) -> Result<(), ApiError>
Deletes one of the campaign’s own.
Sourcepub async fn export_texts<T: RulesText>(
&self,
campaign: Uuid,
) -> Result<Vec<Entry<T>>, ApiError>
pub async fn export_texts<T: RulesText>( &self, campaign: Uuid, ) -> Result<Vec<Entry<T>>, ApiError>
The campaign’s own texts of this kind, as they are.
Sourcepub async fn import_texts<T: RulesText>(
&self,
campaign: Option<Uuid>,
texts: &[T],
) -> Result<Imported, ApiError>
pub async fn import_texts<T: RulesText>( &self, campaign: Option<Uuid>, texts: &[T], ) -> Result<Imported, ApiError>
Like MonsterStore::import: into the shared library or a
campaign, updating ones with the same name, source and edition; all
or nothing.
Trait Implementations§
Source§impl Clone for MonsterStore
impl Clone for MonsterStore
Source§fn clone(&self) -> MonsterStore
fn clone(&self) -> MonsterStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MonsterStore
impl !RefUnwindSafe for MonsterStore
impl Send for MonsterStore
impl Sync for MonsterStore
impl Unpin for MonsterStore
impl UnsafeUnpin for MonsterStore
impl !UnwindSafe for MonsterStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read more§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more