Enum trawler::LobstersRequest
source · pub enum LobstersRequest {
Frontpage,
Recent,
Comments,
User(UserId),
Story(StoryId),
Login,
Logout,
StoryVote(StoryId, Vote),
CommentVote(CommentId, Vote),
Submit {
id: StoryId,
title: String,
},
Comment {
id: CommentId,
story: StoryId,
parent: Option<CommentId>,
},
}
Expand description
A single lobste.rs client request.
Note that one request may end up issuing multiple backend queries. To see which queries are executed by the real lobste.rs, see the lobste.rs source code.
Any request type that mentions an “acting” user is guaranteed to have the user
argument to
handle
be Some
.
Variants
Frontpage
Render the frontpage.
Recent
Render recently submitted stories.
Comments
Render recently submitted comments.
User(UserId)
Render a user’s profile.
Note that the id here should be treated as a username.
Story(StoryId)
Render a particular story.
Login
Log in the acting user.
Note that a user need not be logged in by a LobstersRequest::Login
in order for a
user-action (like LobstersRequest::Submit
) to be issued for that user. The id here should
be considered both a username and an id. The user with the username derived from this
id should have the given id.
Logout
Log out the acting user.
StoryVote(StoryId, Vote)
Have the acting user issue an up or down vote for the given story.
Note that the load generator does not guarantee that a given user will only issue a single vote for a given story, nor that they will issue an equivalent number of upvotes and downvotes for a given story.
CommentVote(CommentId, Vote)
Have the acting user issue an up or down vote for the given comment.
Note that the load generator does not guarantee that a given user will only issue a single vote for a given comment, nor that they will issue an equivalent number of upvotes and downvotes for a given comment.
Submit
Have the acting user submit a new story to the site.
Note that the generator dictates the ids of new stories so that it can more easily keep track of which stories exist, and thus which stories can be voted for or commented on.
Comment
Have the acting user submit a new comment to the given story.
Note that the generator dictates the ids of new comments so that it can more easily keep track of which comments exist for the purposes of generating comment votes and deeper threads.
Implementations
sourceimpl LobstersRequest
impl LobstersRequest
sourcepub fn all() -> IntoIter<Discriminant<Self>>
pub fn all() -> IntoIter<Discriminant<Self>>
Enumerate all possible request types in a deterministic order.
sourcepub fn variant_name(v: &Discriminant<Self>) -> &'static str
pub fn variant_name(v: &Discriminant<Self>) -> &'static str
Give a textual representation of the given LobstersRequest
discriminant.
Useful for printing the keys of the maps of histograms returned by run
.
sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
Produce a textual representation of this request.
These are on the form:
METHOD /path [params] <user>
Where:
METHOD
isGET
orPOST
./path
is the approximate lobste.rs URL endpoint for the request.[params]
are any additional params to the request such as id to assign or associate a new resource with with.
Trait Implementations
sourceimpl Clone for LobstersRequest
impl Clone for LobstersRequest
sourcefn clone(&self) -> LobstersRequest
fn clone(&self) -> LobstersRequest
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for LobstersRequest
impl Debug for LobstersRequest
sourceimpl Hash for LobstersRequest
impl Hash for LobstersRequest
sourceimpl Ord for LobstersRequest
impl Ord for LobstersRequest
sourcefn cmp(&self, other: &LobstersRequest) -> Ordering
fn cmp(&self, other: &LobstersRequest) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialEq<LobstersRequest> for LobstersRequest
impl PartialEq<LobstersRequest> for LobstersRequest
sourcefn eq(&self, other: &LobstersRequest) -> bool
fn eq(&self, other: &LobstersRequest) -> bool
sourceimpl PartialOrd<LobstersRequest> for LobstersRequest
impl PartialOrd<LobstersRequest> for LobstersRequest
sourcefn partial_cmp(&self, other: &LobstersRequest) -> Option<Ordering>
fn partial_cmp(&self, other: &LobstersRequest) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more