Skip to content
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

fix: compile error #665

Merged
merged 15 commits into from
Mar 26, 2024
Merged
16 changes: 8 additions & 8 deletions basic/src/helper/bios_ctx_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tardis::{
TardisFuns, TardisFunsInst,
};

fn unsafe_fill_ctx<F>(request: &Request, f: F, check: bool, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()>
fn unsafe_check_ctx<F>(request: &Request, f: F, check: bool, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()>
where
F: FnOnce(TardisContext, &mut TardisContext),
{
Expand Down Expand Up @@ -35,7 +35,7 @@ where

// xxx_check_own function will check the owner is empty or not.
pub fn check_own_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
let mut roles = bios_ctx.roles.clone();
Expand All @@ -56,8 +56,8 @@ pub fn check_own_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut Ta
)
}

pub fn unsfae_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
pub fn unsafe_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
let mut roles = bios_ctx.roles.clone();
Expand All @@ -79,7 +79,7 @@ pub fn unsfae_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut Tardi
}

pub fn unsfae_fill_owner_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
ctx.owner = bios_ctx.owner.clone();
Expand All @@ -91,7 +91,7 @@ pub fn unsfae_fill_owner_only(request: &Request, funs: &TardisFunsInst, ctx: &mu
}

pub fn unsfae_fill_own_paths_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
ctx.own_paths = bios_ctx.own_paths;
Expand All @@ -103,7 +103,7 @@ pub fn unsfae_fill_own_paths_only(request: &Request, funs: &TardisFunsInst, ctx:
}

pub fn unsfae_fill_roles_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
let mut roles = bios_ctx.roles.clone();
Expand All @@ -122,7 +122,7 @@ pub fn unsfae_fill_roles_only(request: &Request, funs: &TardisFunsInst, ctx: &mu
}

pub fn unsfae_fill_groups_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_fill_ctx(
unsafe_check_ctx(
request,
|bios_ctx, ctx| {
ctx.groups = bios_ctx.groups;
Expand Down
Loading