-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move 'sign_with_time' method to 'S3Action' #28
Conversation
Hey @paolobarbolini! |
Codecov Report
@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 91.60% 91.84% +0.23%
==========================================
Files 25 26 +1
Lines 1286 1250 -36
==========================================
- Hits 1178 1148 -30
+ Misses 108 102 -6
Continue to review full report at Codecov.
|
16c018a
to
609dfa4
Compare
@paolobarbolini on the first try I had some formatting errors. I have fixed those and resubmitted for review. |
@z4f1r0v why many functions are moved? 🤔 |
@guerinoni that's how I read the description of the issue I referenced above. Please correct me if I'm wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and sorry for the delay in my review. Here's a smallish change which should remove a few now useless lines of code.
/// Takes the time at which the URL should be signed | ||
/// Used for testing purposes | ||
fn sign_with_time(&self, expires_in: Duration, time: &OffsetDateTime) -> Url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers to line 38 but I can't seem to be able to comment a line which hasn't been changed so I'll comment this one instead:
Could you add a default implementation of sign:
fn sign(&self, expires_in: Duration) -> Url {
let now = OffsetDateTime::now_utc();
self.sign_with_time(expires_in, &now)
}
so that... (continues in the other comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely 👍
fn sign(&self, expires_in: Duration) -> Url { | ||
let now = OffsetDateTime::now_utc(); | ||
self.sign_with_time(expires_in, &now) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...you can remove all of these sign
implementations which are all the same?
Basically if a trait has a default implementation for a certain function it'll use it when you do impl Trait for T
unless you overwrite it with something else
https://doc.rust-lang.org/book/ch10-02-traits.html#default-implementations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. I'm familiar with the concept. I just did the brainless work of C&P :D
|
||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this @guerinoni?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your repo - your rules. I can remove it if is a big problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's ok, maybe for who use this IDE can be handy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 let's leave it then
609dfa4
to
94903a6
Compare
@paolobarbolini can this be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paolobarbolini can this be merged?
Yeah sorry I kept forgetting to do the final review. Thank you very much for the PR!
As per #27, this PR moves the the
sign_with_time
to theS3Action
trait.