pub struct FilesystemConfig { /* private fields */ }Expand description
A named collection of additional disks, declared by the app itself
(typically in a config/filesystems.rs it writes, the same
“add-your-own-config-file-when-you-need-it” pattern config/blog.rs-
style app-specific config already establishes) - see this module’s
own doc comment for why this exists alongside, not instead of,
local()/public().
§Example
use larust_storage::{DiskConfig, FilesystemConfig};
// config/filesystems.rs
fn config() -> FilesystemConfig {
FilesystemConfig::new()
.with_disk("exports", DiskConfig::private("storage/exports"))
.with_disk("avatars", DiskConfig::public("storage/avatars", "/avatars"))
}
let filesystems = config();
let exports = filesystems.disk("exports")?;
exports.put("2024-01.csv", b"id,total\n").await?;Implementations§
Source§impl FilesystemConfig
impl FilesystemConfig
pub fn new() -> FilesystemConfig
Sourcepub fn with_disk(
self,
name: impl Into<String>,
config: DiskConfig,
) -> FilesystemConfig
pub fn with_disk( self, name: impl Into<String>, config: DiskConfig, ) -> FilesystemConfig
Declares a disk under name - with_*, not a same-named disk,
so this builder method and FilesystemConfig::disk’s own
Laravel-shaped lookup (Storage::disk('name')) can both exist
without a name collision, matching this codebase’s own existing
with_error_pages/with_graceful_shutdown/with_sessions
builder-method convention. Declaring the same name twice silently
keeps the last one - unlike CommandRegistry::register/
JobRegistry::register’s own panic-on-duplicate, a config file is
read top-to-bottom once at startup, not accumulated across
independent call sites the way those two registries are, so a
repeated name here is far more likely to be a deliberate override
(or a copy-pasted block someone forgot to rename) than the kind of
silently-shadowed registration a panic exists to catch.
Sourcepub fn disk(&self, name: &str) -> Result<Disk, AppError>
pub fn disk(&self, name: &str) -> Result<Disk, AppError>
Looks up a declared disk by name - Laravel’s own
Storage::disk('name'). Fails clearly - naming the missing key -
rather than panicking or silently falling back to some default,
the same “explicit, fails loudly on an unknown name” contract
larust_orm::DatabaseConnections’s own connection lookup already
established.
Trait Implementations§
Source§impl Default for FilesystemConfig
impl Default for FilesystemConfig
Source§fn default() -> FilesystemConfig
fn default() -> FilesystemConfig
Auto Trait Implementations§
impl Freeze for FilesystemConfig
impl RefUnwindSafe for FilesystemConfig
impl Send for FilesystemConfig
impl Sync for FilesystemConfig
impl Unpin for FilesystemConfig
impl UnsafeUnpin for FilesystemConfig
impl UnwindSafe for FilesystemConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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