Trait AnyResourceWrite

Source
pub trait AnyResourceWrite:
    Serialize
    + Send
    + Sync {
    type Version: FhirVersion;

    // Required methods
    fn update(
        &mut self,
        conditional: bool,
        client: &Client<Self::Version>,
    ) -> impl Future<Output = Result<bool, Error>> + Send;
    fn create(
        &mut self,
        client: &Client<Self::Version>,
    ) -> impl Future<Output = Result<String, Error>> + Send;
    fn delete(
        self,
        client: &Client<Self::Version>,
    ) -> impl Future<Output = Result<(), Error>> + Send;
}
Expand description

A trait to write the resource enum to the FHIR server, mutating the interior id and version_id so that the resource is up to date for future update requests. This trait sadly needs to be separate to ResourceWrite, because we cannot both implement the generic trait as well as implementing it on a type that fhir-model could implement the required traits for.

Required Associated Types§

Source

type Version: FhirVersion

FHIR client version type.

Required Methods§

Source

fn update( &mut self, conditional: bool, client: &Client<Self::Version>, ) -> impl Future<Output = Result<bool, Error>> + Send

Update the current version of the resource on the server. Returns whether the resource was created.

Source

fn create( &mut self, client: &Client<Self::Version>, ) -> impl Future<Output = Result<String, Error>> + Send

Create this resource on the server. Returns the resource ID.

Source

fn delete( self, client: &Client<Self::Version>, ) -> impl Future<Output = Result<(), Error>> + Send

Delete this resource on the FHIR server.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§