cat_gateway::db::event

Struct EventDB

Source
pub(crate) struct EventDB {}
Expand description

The Catalyst Event SQL Database

Implementations§

Source§

impl EventDB

Source

const BALLOTS_VOTE_OPTIONS_PER_EVENT_QUERY: &'static str = "SELECT vote_options.objective, proposal.id as proposal_id, objective.id as objective_id FROM proposal INNER JOIN objective ON proposal.objective = objective.row_id INNER JOIN vote_options ON objective.vote_options = vote_options.id WHERE objective.event = $1;"

Ballot vote options per event query template

Source

const BALLOTS_VOTE_OPTIONS_PER_OBJECTIVE_QUERY: &'static str = "SELECT vote_options.objective, proposal.id as proposal_id FROM proposal INNER JOIN objective ON proposal.objective = objective.row_id INNER JOIN vote_options ON objective.vote_options = vote_options.id WHERE objective.event = $1 AND objective.id = $2;"

Ballot vote options per objective query template

Source

const BALLOT_VOTE_OPTIONS_QUERY: &'static str = "SELECT vote_options.objective FROM proposal INNER JOIN objective ON proposal.objective = objective.row_id INNER JOIN vote_options ON objective.vote_options = vote_options.id WHERE objective.event = $1 AND objective.id = $2 AND proposal.id = $3;"

Ballot vote options query template

Source

const BALLOT_VOTE_PLANS_QUERY: &'static str = "SELECT proposal_voteplan.bb_proposal_index, voteplan.id, voteplan.category, voteplan.encryption_key, voteplan.group_id FROM proposal_voteplan INNER JOIN proposal ON proposal_voteplan.proposal_id = proposal.row_id INNER JOIN voteplan ON proposal_voteplan.voteplan_id = voteplan.row_id INNER JOIN objective ON proposal.objective = objective.row_id WHERE objective.event = $1 AND objective.id = $2 AND proposal.id = $3;"

Ballot vote plans query template

Source§

impl EventDB

Source

pub(crate) async fn get_ballot( event: EventId, objective: ObjectiveId, proposal: ProposalId, ) -> Result<Ballot>

Get ballot query

Source

pub(crate) async fn get_objective_ballots( &self, event: EventId, objective: ObjectiveId, ) -> Result<Vec<ProposalBallot>>

Get objective’s ballots query

Source

pub(crate) async fn get_event_ballots( &self, event: EventId, ) -> Result<Vec<ObjectiveBallots>>

Get event’s ballots query

Source§

impl EventDB

Source

const OBJECTIVES_QUERY: &'static str = "SELECT objective.row_id, objective.id, objective.title, objective.description, objective.deleted, objective.rewards_currency, objective.rewards_total, objective.extra, objective_category.name, objective_category.description as objective_category_description FROM objective INNER JOIN objective_category on objective.category = objective_category.name WHERE objective.event = $1 LIMIT $2 OFFSET $3;"

Objectives query template

Source

const VOTING_GROUPS_QUERY: &'static str = "SELECT voteplan.group_id as group, voteplan.token_id as voting_token FROM voteplan WHERE objective_id = $1;"

Voting Groups query template

Source§

impl EventDB

Source

pub(crate) async fn get_objectives( event: EventId, limit: Option<i64>, offset: Option<i64>, ) -> Result<Vec<Objective>>

Get objectives query

Source§

impl EventDB

Source

const PROPOSALS_QUERY: &'static str = "SELECT proposal.id, proposal.title, proposal.summary, proposal.deleted FROM proposal INNER JOIN objective on proposal.objective = objective.row_id WHERE objective.event = $1 AND objective.id = $2 LIMIT $3 OFFSET $4;"

Proposals query template

Source

const PROPOSAL_QUERY: &'static str = "SELECT proposal.id, proposal.title, proposal.summary, proposal.deleted, proposal.extra, proposal.funds, proposal.url, proposal.files_url, proposal.proposer_name, proposal.proposer_contact, proposal.proposer_url, proposal.public_key FROM proposal INNER JOIN objective on proposal.objective = objective.row_id WHERE objective.event = $1 AND objective.id = $2 AND proposal.id = $3;"

Proposal details query template

Source§

impl EventDB

Source

pub(crate) async fn get_proposal( event: EventId, objective: ObjectiveId, proposal: ProposalId, ) -> Result<Proposal>

Get proposal query

Source

pub(crate) async fn get_proposals( &self, event: EventId, objective: ObjectiveId, limit: Option<i64>, offset: Option<i64>, ) -> Result<Vec<ProposalSummary>>

Get proposals query

Source§

impl EventDB

Source

const RATINGS_PER_REVIEW_QUERY: &'static str = "SELECT review_rating.metric, review_rating.rating, review_rating.note FROM review_rating WHERE review_rating.review_id = $1;"

Rating per review query template

Source

const REVIEWS_QUERY: &'static str = "SELECT proposal_review.row_id, proposal_review.assessor FROM proposal_review INNER JOIN proposal on proposal.row_id = proposal_review.proposal_id INNER JOIN objective on proposal.objective = objective.row_id WHERE objective.event = $1 AND objective.id = $2 AND proposal.id = $3 LIMIT $4 OFFSET $5;"

Review query template

Source

const REVIEW_TYPES_QUERY: &'static str = "SELECT review_metric.row_id, review_metric.name, review_metric.description, review_metric.min, review_metric.max, review_metric.map, objective_review_metric.note, objective_review_metric.review_group FROM review_metric INNER JOIN objective_review_metric on review_metric.row_id = objective_review_metric.metric INNER JOIN objective on objective_review_metric.objective = objective.row_id WHERE objective.event = $1 AND objective.id = $2 LIMIT $3 OFFSET $4;"

Review types query template

Source§

impl EventDB

Source

pub(crate) async fn get_reviews( event: EventId, objective: ObjectiveId, proposal: ProposalId, limit: Option<i64>, offset: Option<i64>, ) -> Result<Vec<AdvisorReview>>

Get reviews query

Source

pub(crate) async fn get_review_types( &self, event: EventId, objective: ObjectiveId, limit: Option<i64>, offset: Option<i64>, ) -> Result<Vec<ReviewType>>

Get review types query

Source§

impl EventDB

Source

const EVENTS_QUERY: &'static str = "SELECT event.row_id, event.name, event.start_time, event.end_time, snapshot.last_updated FROM event LEFT JOIN snapshot ON event.row_id = snapshot.event ORDER BY event.row_id ASC LIMIT $1 OFFSET $2;"

Events query template

Source

const EVENT_GOALS_QUERY: &'static str = "SELECT goal.idx, goal.name FROM goal WHERE goal.event_id = $1;"

Event goals query template

Source

const EVENT_QUERY: &'static str = "SELECT event.row_id, event.name, event.start_time, event.end_time, event.snapshot_start, event.registration_snapshot_time, event.voting_power_threshold, event.max_voting_power_pct, event.insight_sharing_start, event.proposal_submission_start, event.refine_proposals_start, event.finalize_proposals_start, event.proposal_assessment_start, event.assessment_qa_start, event.voting_start, event.voting_end, event.tallying_end, snapshot.last_updated FROM event LEFT JOIN snapshot ON event.row_id = snapshot.event WHERE event.row_id = $1;"

Event details query template

Source§

impl EventDB

Source

pub(crate) async fn get_events( &self, limit: Option<i64>, offset: Option<i64>, ) -> Result<Vec<EventSummary>>

Get events query

Source

pub(crate) async fn get_event(event: EventId) -> Result<Event>

Get event query

Source§

impl EventDB

Source

const DELEGATIONS_BY_EVENT_QUERY: &'static str = "SELECT contribution.voting_key, contribution.voting_group, contribution.voting_weight, contribution.value, contribution.reward_address FROM contribution INNER JOIN snapshot ON contribution.snapshot_id = snapshot.row_id WHERE contribution.stake_public_key = $1 AND snapshot.event = $2;"

Delegations by event query template

Source

const DELEGATOR_SNAPSHOT_INFO_BY_EVENT_QUERY: &'static str = " SELECT snapshot.as_at, snapshot.last_updated, snapshot.final FROM snapshot WHERE snapshot.event = $1 LIMIT 1;"

Delegator snapshot info by event query template

Source

const DELEGATOR_SNAPSHOT_INFO_BY_LAST_EVENT_QUERY: &'static str = "SELECT snapshot.event, snapshot.as_at, snapshot.last_updated, snapshot.final FROM snapshot WHERE snapshot.last_updated = (SELECT MAX(snapshot.last_updated) as last_updated from snapshot) LIMIT 1;"

Delegator snapshot info by last event query template

Source

const TOTAL_BY_EVENT_VOTING_QUERY: &'static str = "SELECT SUM(voter.voting_power)::BIGINT as total_voting_power FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id WHERE voter.voting_group = $1 AND snapshot.event = $2;"

Total By Event Query template

Source

const TOTAL_BY_LAST_EVENT_VOTING_QUERY: &'static str = "SELECT SUM(voter.voting_power)::BIGINT as total_voting_power FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id AND snapshot.last_updated = (SELECT MAX(snapshot.last_updated) as last_updated from snapshot) WHERE voter.voting_group = $1;"

Total By Last Event Query template

Source

const TOTAL_POWER_BY_EVENT_QUERY: &'static str = "SELECT SUM(voter.voting_power)::BIGINT as total_voting_power FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id WHERE snapshot.event = $1;"

Total voting power by event query template

Source

const TOTAL_POWER_BY_LAST_EVENT_QUERY: &'static str = "SELECT SUM(voter.voting_power)::BIGINT as total_voting_power FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id WHERE snapshot.last_updated = (SELECT MAX(snapshot.last_updated) as last_updated from snapshot);"

Total voting power by last event query template

Source

const VOTER_BY_EVENT_QUERY: &'static str = "SELECT voter.voting_key, voter.voting_group, voter.voting_power, snapshot.as_at, snapshot.last_updated, snapshot.final, SUM(contribution.value)::BIGINT as delegations_power, COUNT(contribution.value) AS delegations_count FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id INNER JOIN contribution ON contribution.snapshot_id = snapshot.row_id WHERE voter.voting_key = $1 AND contribution.voting_key = $1 AND snapshot.event = $2 GROUP BY voter.voting_key, voter.voting_group, voter.voting_power, snapshot.as_at, snapshot.last_updated, snapshot.final;"

Voter By Event Query template

Source

const VOTER_BY_LAST_EVENT_QUERY: &'static str = "SELECT snapshot.event, voter.voting_key, voter.voting_group, voter.voting_power, snapshot.as_at, snapshot.last_updated, snapshot.final, SUM(contribution.value)::BIGINT as delegations_power, COUNT(contribution.value) AS delegations_count FROM voter INNER JOIN snapshot ON voter.snapshot_id = snapshot.row_id INNER JOIN contribution ON contribution.snapshot_id = snapshot.row_id WHERE voter.voting_key = $1 AND contribution.voting_key = $1 AND snapshot.last_updated = (SELECT MAX(snapshot.last_updated) as last_updated from snapshot) GROUP BY snapshot.event, voter.voting_key, voter.voting_group, voter.voting_power, snapshot.as_at, snapshot.last_updated, snapshot.final;"

Voter By Last Event Query template

Source

const VOTER_DELEGATORS_LIST_QUERY: &'static str = "SELECT contribution.stake_public_key FROM contribution INNER JOIN snapshot ON contribution.snapshot_id = snapshot.row_id WHERE contribution.voting_key = $1 AND snapshot.event = $2;"

Voter Delegators List Query template

Source§

impl EventDB

Source

pub(crate) async fn get_voter( event: &Option<EventId>, voting_key: String, with_delegations: bool, ) -> Result<Voter>

Get voter query

Source

pub(crate) async fn get_delegator( event: &Option<EventId>, stake_public_key: String, ) -> Result<Delegator>

Get delegator query

Source§

impl EventDB

Source

const SEARCH_EVENTS_QUERY: &'static str = "SELECT event.row_id, event.name, event.start_time, event.end_time, snapshot.last_updated FROM event LEFT JOIN snapshot ON event.row_id = snapshot.event"

Search for events query template

Source

const SEARCH_OBJECTIVES_QUERY: &'static str = "SELECT objective.id, objective.title, objective.description, objective.deleted, objective_category.name, objective_category.description as objective_category_description FROM objective INNER JOIN objective_category on objective.category = objective_category.name"

Search for objectives query template

Source

const SEARCH_PROPOSALS_QUERY: &'static str = "SELECT DISTINCT proposal.id, proposal.title, proposal.summary, proposal.deleted FROM proposal"

Search for proposals query template

Source

fn build_where_clause(table: &str, filter: &[SearchConstraint]) -> String

Build a where clause

Source

fn build_order_by_clause(table: &str, order_by: &[SearchOrderBy]) -> String

Build an order by clause

Source

fn construct_query(search_query: &SearchQuery) -> String

Construct a search query

Source

fn construct_count_query(search_query: &SearchQuery) -> String

Construct a count query

Source

async fn search_total( search_query: SearchQuery, limit: Option<i64>, offset: Option<i64>, ) -> Result<SearchResult>

Search for a total.

Source

async fn search_events( search_query: SearchQuery, limit: Option<i64>, offset: Option<i64>, ) -> Result<SearchResult>

Search for events

Source

async fn search_objectives( &self, search_query: SearchQuery, limit: Option<i64>, offset: Option<i64>, ) -> Result<SearchResult>

Search for objectives

Source

async fn search_proposals( &self, search_query: SearchQuery, limit: Option<i64>, offset: Option<i64>, ) -> Result<SearchResult>

Search for proposals

Source§

impl EventDB

Source

pub(crate) async fn search( &self, search_query: SearchQuery, total: bool, limit: Option<i64>, offset: Option<i64>, ) -> Result<SearchResult>

Search query

Source§

impl EventDB

Source

const FUND_CHALLENGES_QUERY: &'static str = "SELECT objective.row_id AS internal_id, objective.id AS id, objective.category AS challenge_type, objective.title AS title, objective.description AS description, objective.rewards_total AS rewards_total, objective.proposers_rewards AS proposers_rewards, (objective.extra->'url') #>> '{}' AS challenge_url, (objective.extra->'sponsor') #>> '{}' AS highlights FROM objective WHERE objective.event = $1;"

Source

const FUND_GOALS_QUERY: &'static str = "SELECT id, name AS goal_name FROM goal WHERE goal.event_id = $1;"

Source

const FUND_GROUPS_QUERY: &'static str = "SELECT voteplan.token_id AS token_identifier, voting_group.name AS group_id FROM voting_group INNER JOIN voteplan ON voteplan.group_id = voting_group.name INNER JOIN objective ON voteplan.objective_id = objective.row_id WHERE objective.event = $1;"

Source

const FUND_QUERY: &'static str = "SELECT this_fund.row_id AS id, this_fund.name AS fund_name, this_fund.description AS fund_goal, this_fund.registration_snapshot_time AS registration_snapshot_time, this_fund.voting_power_threshold AS voting_power_threshold, this_fund.start_time AS fund_start_time, this_fund.end_time AS fund_end_time, this_fund.insight_sharing_start AS insight_sharing_start, this_fund.proposal_submission_start AS proposal_submission_start, this_fund.refine_proposals_start AS refine_proposals_start, this_fund.finalize_proposals_start AS finalize_proposals_start, this_fund.proposal_assessment_start AS proposal_assessment_start, this_fund.assessment_qa_start AS assessment_qa_start, this_fund.snapshot_start AS snapshot_start, this_fund.voting_start AS voting_start, this_fund.voting_end AS voting_end, this_fund.tallying_end AS tallying_end, (this_fund.extra->'url'->'results') #>> '{}' AS results_url, (this_fund.extra->'url'->'survey') #>> '{}' AS survey_url, next_fund.row_id AS next_id, next_fund.start_time AS next_fund_start_time, next_fund.registration_snapshot_time AS next_registration_snapshot_time, next_fund.name AS next_fund_name, next_fund.insight_sharing_start AS next_insight_sharing_start, next_fund.proposal_submission_start AS next_proposal_submission_start, next_fund.refine_proposals_start AS next_refine_proposals_start, next_fund.finalize_proposals_start AS next_finalize_proposals_start, next_fund.proposal_assessment_start AS next_proposal_assessment_start, next_fund.assessment_qa_start AS next_assessment_qa_start, next_fund.snapshot_start AS next_snapshot_start, next_fund.voting_start AS next_voting_start, next_fund.voting_end AS next_voting_end, next_fund.tallying_end AS next_tallying_end FROM event this_fund LEFT JOIN event next_fund ON next_fund.row_id = this_fund.row_id + 1 WHERE this_fund.end_time > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND this_fund.start_time < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' ORDER BY this_fund.row_id DESC LIMIT 1;"

Source

const FUND_VOTE_PLANS_QUERY: &'static str = "SELECT voteplan.row_id AS id, voteplan.id AS chain_voteplan_id, voteplan.category AS chain_voteplan_payload, voteplan.encryption_key AS chain_vote_encryption_key, event.row_id AS fund_id, voteplan.token_id AS token_identifier FROM voteplan INNER JOIN objective ON voteplan.objective_id = objective.row_id INNER JOIN event ON objective.event = event.row_id WHERE event.row_id = $1;"

Source§

impl EventDB

Source

pub(crate) async fn get_fund() -> Result<FundWithNext>

Get fund query

Source§

impl EventDB

Source

pub(crate) async fn schema_version_check() -> Result<i32>

Check the schema version. return the current schema version if its current. Otherwise return an error.

Source§

impl EventDB

Source

pub(crate) fn is_deep_query_enabled() -> bool

Determine if deep query inspection is enabled.

Source

pub(crate) fn modify_deep_query(enable: bool)

Modify the deep query inspection setting.

§Arguments
  • enable - Set the DeepQueryInspection setting to this value.
Source

pub(crate) async fn query( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Vec<Row>>

Query the database.

If deep query inspection is enabled, this will log the query plan inside a rolled-back transaction, before running the query.

§Arguments
  • stmt - &str SQL statement.
  • params - &[&(dyn ToSql + Sync)] SQL parameters.
§Returns

anyhow::Result<Vec<Row>>

Source

pub(crate) async fn query_stream( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<impl Stream<Item = Result<Row>>>

Query the database and return a async stream of rows.

If deep query inspection is enabled, this will log the query plan inside a rolled-back transaction, before running the query.

§Arguments
  • stmt - &str SQL statement.
  • params - &[&(dyn ToSql + Sync)] SQL parameters.
§Returns

anyhow::Result<impl Stream<Item = anyhow::Result<Row>>>

Source

pub(crate) async fn query_one( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Row>

Query the database for a single row.

§Arguments
  • stmt - &str SQL statement.
  • params - &[&(dyn ToSql + Sync)] SQL parameters.
§Returns

Result<Row, anyhow::Error>

Source

pub(crate) async fn modify( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<()>

Modify the database.

Use this for UPDATE, DELETE, and other DB statements that don’t return data.

§Arguments
  • stmt - &str SQL statement.
  • params - &[&(dyn ToSql + Sync)] SQL parameters.
§Returns

anyhow::Result<()>

Source

async fn explain_analyze_rollback( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<()>

Prepend EXPLAIN ANALYZE to the query, and rollback the transaction.

Source

async fn explain_analyze_commit( stmt: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<()>

Prepend EXPLAIN ANALYZE to the query, and commit the transaction.

Source

async fn explain_analyze( stmt: &str, params: &[&(dyn ToSql + Sync)], rollback: bool, ) -> Result<()>

Prepend EXPLAIN ANALYZE to the query.

Log the query plan inside a transaction that may be committed or rolled back.

§Arguments
  • stmt - &str SQL statement.
  • params - &[&(dyn ToSql + Sync)] SQL parameters.
  • rollback - bool whether to roll back the transaction or not.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,