Scenic.Assets.Stream.put

You're seeing just the function put, go back to Scenic.Assets.Stream module for more information.

Specs

put(id :: String.t(), asset :: asset()) ::
  :ok | {:error, atom()} | {:error, atom(), any()}

Put a streamable asset into a named stream.

If the named stream does not exist yet, it is created. If it already exists, then it's content is updated with the asset.

Returns :ok on success.

Note: Once a stream is create, the asset being updated must be the same type as the asset that was originally created. I.e. you can't replace a Bitmap with an Image. This will make more sense in the future as other assets types (audio) become supported.

The contents of the asset is (lightly) validated as it is put into the :ets table. If the content is invalid, or a different type than what is already in the stream, then it returns {:error, :invalid, asset_type}.