Skip to content

Commit

Permalink
s/CallRet/Item/
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed May 14, 2024
1 parent 025ff70 commit eaa3633
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions pgrx/src/callconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub trait UnboxArg {
/// behind the FunctionCallInfo. The most exceptional case are set-returning functions.
pub unsafe trait ReturnShipping: Sized {
/// The actual type returned from the call
type CallRet: Sized;
type Item: Sized;

/// check the fcinfo state, initialize if necessary, and pick calling the wrapped fn or restoring Self
///
Expand Down Expand Up @@ -104,7 +104,7 @@ unsafe impl<T> ReturnShipping for T
where
T: RetPackage,
{
type CallRet = Self;
type Item = Self;
fn label_ret(self) -> Ret<Self> {
Ret::Once(self)
}
Expand Down Expand Up @@ -153,7 +153,7 @@ unsafe impl<'a, T> ReturnShipping for SetOfIterator<'a, T>
where
T: ReturnShipping,
{
type CallRet = <Self as Iterator>::Item;
type Item = <Self as Iterator>::Item;
unsafe fn prepare_call(fcinfo: pg_sys::FunctionCallInfo) -> CallCx {
prepare_value_per_call_srf(fcinfo)
}
Expand Down Expand Up @@ -211,15 +211,15 @@ where

pub enum Ret<T: ReturnShipping> {
Zero,
Once(T::CallRet),
Many(T, T::CallRet),
Once(T::Item),
Many(T, T::Item),
}

unsafe impl<'a, T> ReturnShipping for TableIterator<'a, T>
where
T: ReturnShipping,
{
type CallRet = <Self as Iterator>::Item;
type Item = <Self as Iterator>::Item;

unsafe fn prepare_call(fcinfo: pg_sys::FunctionCallInfo) -> CallCx {
prepare_value_per_call_srf(fcinfo)
Expand Down Expand Up @@ -306,9 +306,9 @@ pub(crate) fn srf_memcx(fcx: *mut pg_sys::FuncCallContext) -> PgMemoryContexts {
unsafe impl<T> ReturnShipping for Option<T>
where
T: ReturnShipping,
T::CallRet: ReturnShipping,
T::Item: ReturnShipping,
{
type CallRet = T::CallRet;
type Item = T::Item;

unsafe fn prepare_call(fcinfo: pg_sys::FunctionCallInfo) -> CallCx {
T::prepare_call(fcinfo)
Expand Down Expand Up @@ -359,10 +359,10 @@ where
unsafe impl<T, E> ReturnShipping for Result<T, E>
where
T: ReturnShipping,
T::CallRet: ReturnShipping,
T::Item: ReturnShipping,
E: core::any::Any + core::fmt::Display,
{
type CallRet = T::CallRet;
type Item = T::Item;

unsafe fn prepare_call(fcinfo: pg_sys::FunctionCallInfo) -> CallCx {
T::prepare_call(fcinfo)
Expand Down
4 changes: 2 additions & 2 deletions pgrx/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ where
C: ReturnShipping, // so we support TableIterator<'a, (Option<T>,)> as well
Self: IntoHeapTuple,
{
type CallRet = Self;
type Item = Self;

fn label_ret(self) -> Ret<Self> {
Ret::Once(self)
Expand Down Expand Up @@ -256,7 +256,7 @@ macro_rules! impl_table_iter {
$($C: ReturnShipping,)*
Self: IntoHeapTuple,
{
type CallRet = Self;
type Item = Self;

fn label_ret(self) -> Ret<Self> {
Ret::Once(self)
Expand Down

0 comments on commit eaa3633

Please sign in to comment.