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

impl ExploreService #79

Merged
merged 12 commits into from
Jan 25, 2025
Merged

impl ExploreService #79

merged 12 commits into from
Jan 25, 2025

Conversation

helgev-traP
Copy link
Contributor

No description provided.

@helgev-traP helgev-traP force-pushed the server-impl-explore-service branch from 47503bb to 32d0752 Compare January 25, 2025 03:14
@helgev-traP
Copy link
Contributor Author

filter out unrelatedはExplorerFoeldの範囲内に居るものを抜き出しています。

collect newly containedは今は新しい位置と古い位置の両方でget_*_inareaして新しい位置で取得されたものから古い位置の物を削除して作っています。
古い位置での一覧のキャッシュを残しておくと再取得しなくて済むようになるかも。


ProvideMessageServiceの中にget_messages_in_areaが必要だったので追記しました。

server/src/explore/impl.rs Outdated Show resolved Hide resolved
server/src/explore/impl.rs Outdated Show resolved Hide resolved
@helgev-traP
Copy link
Contributor Author

old_area_*_cacheに保管しておくようにしました。

filter_mapを使うようにしました。

@helgev-traP helgev-traP force-pushed the server-impl-explore-service branch from b004d7d to ea9960b Compare January 25, 2025 05:08
server/src/explore/impl.rs Outdated Show resolved Hide resolved
@helgev-traP helgev-traP force-pushed the server-impl-explore-service branch from cf56a4e to 741a6c6 Compare January 25, 2025 05:42
@helgev-traP
Copy link
Contributor Author

helgev-traP commented Jan 25, 2025

matchを切り出した。
引数が多すぎるとclippyに怒られたのでStatusにキャッシュとかをまとめた。

Eventの範囲判定忘れてたので書いた。

server/src/explore/impl.rs Outdated Show resolved Hide resolved
server/src/explore/impl.rs Outdated Show resolved Hide resolved
server/src/explore/impl.rs Outdated Show resolved Hide resolved
@helgev-traP helgev-traP force-pushed the server-impl-explore-service branch from cad5d24 to 2ff976f Compare January 25, 2025 06:35
+ ProvideExplorerService,
{
async_stream::try_stream! {
let (id, mut exploration_field_stream) = (params.id, params.stream);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let (id, mut exploration_field_stream) = (params.id, params.stream);
let super::ExploreParams { id, stream: mut exploration_field_stream } = params;

server/src/explore/impl.rs Show resolved Hide resolved
Comment on lines 560 to 563
let x_min = center.x - size.width / 2;
let x_max = center.x + size.width / 2;
let y_min = center.y - size.height / 2;
let y_max = center.y + size.height / 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u32::saturating_addとか使って欲しいです

https://doc.rust-lang.org/std/primitive.u32.html#method.saturating_add

@helgev-traP helgev-traP changed the title 現状 filter out とcollect newly contained以外 impl ExploreService Jan 25, 2025
@helgev-traP helgev-traP merged commit d2fbaea into main Jan 25, 2025
4 checks passed
@helgev-traP helgev-traP deleted the server-impl-explore-service branch January 25, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants