You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many common functions in atomic_lib, like Rersource::new, take a String as an argument.
This has some problems:
We need a lot of .into_string
Any functions relating to Subjects are hard to discover (e.g. check if URLs are valid)
We could improve this by:
Accepting impl From<String>, which deals with &str as well as String. This is the easy approach that already brings some decent DX improvements.
Accepting a new type for Subject, which implements From<String> and display.
This second Subject type deserves some thoughts:
Subjects are currently practically always http URLs. Therefore, it might make sense to simply treat them as URLs
We'll probably introduce a type of local-id in the future. There are (probably) still URLs!
We could add some useful features, like a method to check if it's a local or not, or what the root of the origin is or something.
If creating a Subject requires parsing the string, we should consider performance impact, e.g. when constructing a Resource from a binary blob. Same goes for serialisation! So perhaps URLs are a bit too expensive?
If we use one type for all these subjects, refactoring will be far easier (e.g. if we'll rename subject to id)
In a recent PR, we already have an AtomicURL type. This creates a URL under the hood, and provides some methods for getting specific routes / subdomains. Perhaps this could be the ID type?
The text was updated successfully, but these errors were encountered:
Many common functions in
atomic_lib
, likeRersource::new
, take aString
as an argument.This has some problems:
.into_string
We could improve this by:
impl From<String>
, which deals with&str
as well asString
. This is the easy approach that already brings some decent DX improvements.Subject
, which implementsFrom<String>
anddisplay
.This second
Subject
type deserves some thoughts:http
URLs. Therefore, it might make sense to simply treat them as URLslocal-id
in the future. There are (probably) still URLs!local
or not, or what the root of the origin is or something.Subject
requires parsing the string, we should consider performance impact, e.g. when constructing a Resource from a binary blob. Same goes for serialisation! So perhaps URLs are a bit too expensive?subject
toid
)AtomicURL
type. This creates a URL under the hood, and provides some methods for getting specific routes / subdomains. Perhaps this could be theID
type?The text was updated successfully, but these errors were encountered: